Giter Site home page Giter Site logo

gowatch's Introduction

A simple Go file watcher that will stop & restart your main() function on file changes.

Motivation

I just want to stop my server, and run it again every time I save a file.

installation

go install marwan.io/gowatch@latest

Usage

from your main app directory, run gowatch

What it does

it reads your current working directory and runs the two typical commands:

  • go build

  • ./<name-of-compiled-binary>

So this only works in main packages.

Also, this ignores your vendor folder & your _test.go files.

FAQ

Q: Why doesn't it just run go run main.go?

A: go run does the same thing as go build, but calls the resulting binary as a subprocess. This makes it harder to reach stdout and killing the main.go process, won't necessarily kill the subprocess, so you end up trying to run the server twice (which ends up with "port is already taken" kind of error).

Q: How does it compare with other tools?

A: I haven't tried most of them, but I wanted to make this as simple as just running one command to get what I'm looking for without having to turn and twist a lot of knobs.

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.