Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

zgo.at/follow

Package Overview
Dependencies
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zgo.at/follow

Go Modules
Version
v0.0.0-20260217115453-4d2d0f0de407
Version published
Created
Source

Go library to follow a file for changes; e.g. "tail -F".

There's a little example application in cmd/tail/main.go:

func main() {
	if len(os.Args) <= 1 {
		fmt.Println("need at least one filename")
		os.Exit(1)
	}

	f := follow.New()

	// Maximum time to retry opening the file after it goes away; -1 to keep
	// trying forever.
	f.Retry = -1

	// Install signal handler; any signal sent to this will reopen the file; you
	// can send something manually with:
	//    f.Reopen <- os.Interrupt
	signal.Notify(f.Reopen, syscall.SIGHUP)

	// Keep reading data in the background, sending it to the f.Data channel.
	go func() { log.Fatal(f.Start(context.Background(), os.Args[1])) }()

	for {
		data := <-f.Data
		if data.Err != nil {
			if data.Err == io.EOF {
				break
			}
			log.Fatal(data.Err)
		}
		fmt.Println("X", data)
	}
}

FAQs

Package last updated on 17 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts