watch

package module
v1.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 9 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Watcher

Make it create watcher easier.

PkgGoDev Build Status Go Report Card Coverage Status GitHub issues Release

Installation

To install the package, run:

go get github.com/go-zoox/watcher

Getting Started

import (
  "testing"
  "github.com/go-zoox/watcher"
)

func main(t *testing.T) {
	pwd, _ := os.Getwd()
	watcher := watcher.New(&watcher.Config{
		Context: path.Join(pwd, "example/program"),
		Ignores: []string{},
		Exts: []string{".go", ".mod", ".sum"},
		Commands: []string{
			"go run .",
		},
	})

	if err := watcher.Watch(); err != nil {
		logger.Error("failed to watch: %s", err)
	}
}

Inspired By

  • silenceper/gowatch - 🚀 gowatch is a command line tool that builds and (re)starts your go project everytime you save a Go or template file.
  • fsnotify/fsnotify - Cross-platform file system notifications for Go.

Platform Support

Feature Linux macOS Windows
File Watching ✓ ✓ ✓
Process Kill ✓ ✓ ✓
Process Group ✓ ✓ -

Windows does not support process group killing (Setpgid/syscall.Kill with negative PID). On Windows, Process.Kill() is used directly.

License

GoZoox is released under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "1.3.3"

Version is the current version of the package.

Functions

This section is empty.

Types

type Config

type Config struct {
	Commands []string
	Context  string
	Paths    []string
	Ignores  []string
	Exts     []string
	Env      map[string]string
	// go | golang
	Mode string
}

type Watcher

type Watcher interface {
	Watch() error
	Stop() error
}

func New

func New(cfg *Config) Watcher

Directories

Path Synopsis
cmd
watch command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址