Giter Site home page Giter Site logo

gowatch's Introduction

gowatch

Go files watcher for Gophers and everyone else.

A tiny Go program that can:

  • Run gofmt on saving Go files
  • Run a "main" file and restart when it changes.

Install

If you already have your Go workspace and GOPATH set, simply run:

go get -u github.com/sikhapol/gowatch

How to use

Simple

  • Run gofmt -w upon saving Go files.
  • Run main function when the file is saved.
gowatch

Specify watched directory

gowatch /path/to/watch/

Specify Go file to run

gowatch -r /path/to/main.go

Specify stdin for the run main file

gowatch -i input.txt

Format only

gowatch -n

Delay reporting file change

gowatch -d 5 #seconds

This mean that if a file has changed, gowatch will not take any action if it's changed again within 5 seconds. This is to prevent a loop that cause by gofmt changing the file that cause gowatch to detect change and format the file again and so on. Default is 1 second.

For everything else

gowatch knows if you send input to another command with UNIX pipe. In this case, it will just print the changed file names to stdout which you can then send to another command like xargs to further do anything interesting.

gowatch | xargs cat

License

MIT

gowatch's People

Stargazers

Ambas Chobsanti avatar Yusuke Onishi avatar

Watchers

James Cloos avatar Yusuke Onishi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.