helpmakego

command module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 3 Imported by: 0

README

helpmakego - A make dependency resolver for Go

Returns a list of files which will be used to compile a go package.

This is specifically designed for integration into Makefiles where the timestamps of each source file are used to determine if the target binary needs to be rebuilt.

Installation

helpmakego is designed to be used from directly within a Makefile:

myprogram: $(go tool github.com/iwahbe/helpmakego cmd/myprogram)
	go build cmd/myprogram

The easiest way to use helpmakego is with go tool[^1]:

# Run once
go get -tool github.com/iwahbe/helpmakego

You can also use go install github.com/iwahbe/helpmakego@latest to install globally and then invoke helpmakego directly.

CLI usage

Usage:
  helpmakego [path-to-package] [--test] [flags]

Flags:
  -h, --help   help for helpmakego
      --test   include test files in the dependency analysis

The output by default is a list of space-separated files. If any of these files are edited, the target program will need to be rebuilt.

Example
$ go tool github.com/iwahbe/helpmakego cmd/myprogram
cmd/myprogram/main.go go.mod go.sum

How it Works

helpmakego is a tool designed to resolve dependencies for Go projects, making it easier to integrate with Makefiles. It traverses the Go module's directory structure, identifying all files that are part of the module, including optional test files if specified.

helpmakego aims to provide as fine grain a dependency set as possible. It respects:

  • go.mod (including local replace directives) and go.sum
  • go.work (including local replace directives) and go.work.sum
  • go:embed directives

Like the go build tool itself, helpmakego only considers packages that are actually referenced.

[^1]: Added in Go 1.24: https://pkg.go.dev/cmd/go#hdr-Run_specified_go_tool

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
cmd
pkg/log
Package log provides an abstraction over the standard libraries "log/slog" that is tied to a context.Context.
Package log provides an abstraction over the standard libraries "log/slog" that is tied to a context.Context.

Jump to

Keyboard shortcuts

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