https://github.com/code-hex/go-version-update
Update the version string of your go project.
https://github.com/code-hex/go-version-update
Last synced: 7 months ago
JSON representation
Update the version string of your go project.
- Host: GitHub
- URL: https://github.com/code-hex/go-version-update
- Owner: Code-Hex
- License: mit
- Created: 2017-01-04T14:40:55.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-06T12:12:17.000Z (almost 9 years ago)
- Last Synced: 2025-03-30T23:12:14.320Z (9 months ago)
- Language: Go
- Homepage:
- Size: 961 KB
- Stars: 20
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-version-update
[](https://goreportcard.com/report/github.com/Code-Hex/go-version-update) [](https://godoc.org/github.com/Code-Hex/go-version-update)
Update the version string of your go project.
Rewrite the value of the `const` or `var` variables matching `/version/i` to the specified version string.
# Synopsis
```go
package main
import update "github.com/Code-Hex/go-version-update"
func main() {
// Find go files are described version variables.
founds, err := update.GrepVersion("target_directory")
if err != nil {
panic(err)
}
// Re write value of version variables.
for _, path := range founds {
// Re write to "1.2.3"
if err := update.NextVersion(os.Stdout, "1.2.3", path); err != nil {
panic(err)
}
}
}
```
You can also modify the version of your project using the `goversion` command.
## goversion
```
Usage: goversion [options]
Options:
-h, --help print usage and exit
-f, --format rewrite version of code
-d, --dir target directory
```
# Installation
- Library install
go get github.com/Code-Hex/go-version-update
- `goversion` command install
go get github.com/Code-Hex/go-version-update/cmd/goversion
# Contribute
If you find an issue with this library, please report an issue.
If you'd like, we welcome any contributions. Fork this library and submit a pull request.
# License
[MIT](https://github.com/Code-Hex/go-version-update/blob/master/LICENSE)
# Author
[codehex](https://twitter.com/CodeHex)