https://github.com/fhofherr/toolmgr
toolmgr helps you manage go tools using a tools.go file
https://github.com/fhofherr/toolmgr
development-tools golang
Last synced: about 2 months ago
JSON representation
toolmgr helps you manage go tools using a tools.go file
- Host: GitHub
- URL: https://github.com/fhofherr/toolmgr
- Owner: fhofherr
- License: mit
- Created: 2021-05-08T11:56:38.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-05-08T13:40:22.000Z (about 4 years ago)
- Last Synced: 2025-04-01T14:21:59.548Z (3 months ago)
- Topics: development-tools, golang
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# toolmgr
`toolmgr` helps you manage go tools using a
[tools.go](https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module)
file.## Usage
Create a `tools.go` file with at least the following content:
```go
//+build toolspackage tools
import (
_ "github.com/fhofherr/toolmgr"
)
```Add imports for the used tools to the above files as required. Then make
sure to install `toolmgr`:```sh
export GOBIN="$PWD/bin"
go mod tidy
go install github.com/fhofherr/toolmgr
"$PWD"/bin/toolmgr -bin-dir "$PWD/bin"
```Whenever you add new tools to `tools.go` be sure to re-execute the above
steps.### Makefile targets
In many cases it is convenient to use a `Makefile` to make the above
easier. Simply add the following targets to your `Makefile`.```Makefile
GO ?= go## Change this to your liking:
TOOLS_BIN_DIR ?= bin
TOOLS_GO := tools.go.PHONY: tools
tools: $(TOOLS_BIN_DIR)## Dummy target to allow depending on all tools
$(TOOLS_BIN_DIR): $(TOOLS_BIN_DIR)/toolmgr$(TOOLS_BIN_DIR)/%: $(TOOLS_GO)
GOBIN=$(abspath ./$(TOOLS_BIN_DIR)) $(GO) install github.com/fhofherr/toolmgr
$(TOOLS_BIN_DIR)/toolmgr -bin-dir $(TOOLS_BIN_DIR) -tools-go $(TOOLS_GO)
```Whenever one of your other `Makefile` targets depends on one or more
tools you can either depend on the `$(TOOLS_BIN_DIR)` target or on
`$(TOOTOOLS_BIN_DIR)/`.## License
Copyright © 2021 Ferdinand Hofherr
Distributed under the MIT License.