Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoSubmodule = errors.New("no submodule found") ErrNotRelease = errors.New("HEAD is not a release commit") )
Functions ¶
func TagRepo ¶
TagRepo determines what the curent version of the repository is by parsing the commit history since previous release and returns that version. Depending on the state of the Config passed it, it may also create the tag and push it.
This function is deprecated and will be removed before the v1.0.0 release of gotagger.
Types ¶
type Config ¶
type Config struct { // CreateTag represents whether to create the tag. CreateTag bool // ExcludeModules is a list of module names or paths to exclude. ExcludeModules []string // IgnoreModules controls whether gotagger will ignore the existence of // go.mod files when determinging how to version a project. IgnoreModules bool // RemoteName represents the name of the remote repository. Defaults to origin. RemoteName string // PreMajor controls whether gotagger will increase the major version from 0 // to 1 for breaking changes. PreMajor bool // PushTag represents whether to push the tag to the remote git repository. PushTag bool // VersionPrefix is a string that will be added to the front of the version. Defaults to 'v'. VersionPrefix string }
Config represents how to tag a repo. If not default is mentioned, the option defaults to go's zero-value.
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig returns a Config with default options set.
If an option is not mentioned, then the default is the zero-value for its type.
- RemoteName origin
- VersionPrefix v
type Gotagger ¶
type Gotagger struct { Config Config // contains filtered or unexported fields }
func (*Gotagger) ModuleVersions ¶
ModuleVersions returns the current version for all go modules in the repository in the order they were found by a depth-first, lexicographically sorted search.
For example, in a repository with a root go.mod and a submodule foo/bar, the slice returned would be: []string{"v0.1.0", "bar/v0.1.0"}
If module names are passed in, then only the versions for those modules are returned.
func (*Gotagger) TagRepo ¶
TagRepo determines the curent version of the repository by parsing the commit history since the previous release and returns that version. Depending on the CreateTag and PushTag configuration options tags may be created and pushed.
If the current commit contains one or more Modules footers, then tags are created for each module listed. In this case if the root module is not explicitly included in a Modules footer then it will not be included.
func (*Gotagger) Version ¶
Version returns the current version for the repository.
In a repository that contains multiple go modules, this returns the version of the first module found by a depth-first, lexicographically sorted search. Usually this is the root module, but possibly not if the repo is a monorepo with no root module.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
The git package contains functions for running git commands.
|
The git package contains functions for running git commands. |
internal
|
|
git
The git package contains functions for running git commands.
|
The git package contains functions for running git commands. |
Package marker implements finding and working with markers in commit messages.
|
Package marker implements finding and working with markers in commit messages. |