update

package module
v0.0.0-...-d31d6d7 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2017 License: MIT Imports: 12 Imported by: 0

README

go-version-update

Go Report Card GoDoc
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

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 <version>       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

Author

codehex

Documentation

Index

Constants

View Source
const Version = "1.0.0"

Version for go-version-update

Variables

This section is empty.

Functions

func GrepVersion

func GrepVersion(basedir string) ([]*info, error)

GrepVersion will detect go files for "version" variables in the project.

func NextVersion

func NextVersion(fi io.Writer, version, path string) error

NextVersion will replace values of "version" attributes. fi: Specify the output destination of formatted code. path: target file.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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