Feature/dependency pinning and update automation (#5451)

* * handle local flag
* add managerfactory handling for local flag
* add shortName handling for local flag
* add dot git file handling for local flag
* add tests

* fix normal listing

* add ParseGitRepository function, add viper, add testing for utils

* add latest tag logic, add auto pinning and auto fetching

* makke gorepomod list works with --local

* make pinning works with local flag, enable auto update on fork and non-fork repo

* fix: refactor to pass linter

* refactor code and fix comments

* edit README

* refactor code to pass linting

* refactor code

* refactor code and enable patch branch label

* ru add license

* fbackward compatibility for unpin
This commit is contained in:
Kurnianto Trilaksono
2024-01-17 05:34:56 +08:00
committed by GitHub
parent f3fedac429
commit ab519fdc13
18 changed files with 1189 additions and 88 deletions

View File

@@ -14,6 +14,7 @@ import (
const (
doItFlag = "--doIt"
localFlag = "--local"
cmdPin = "pin"
cmdUnPin = "unpin"
cmdTidy = "tidy"
@@ -64,6 +65,7 @@ type Args struct {
version semver.SemVer
bump semver.SvBump
doIt bool
localFlag bool
}
func (a *Args) GetCommand() Command {
@@ -106,9 +108,14 @@ func (a *Args) DoIt() bool {
return a.doIt
}
func (a *Args) LocalFlag() bool {
return a.localFlag
}
type myArgs struct {
args []string
doIt bool
args []string
doIt bool
localFlag bool
}
func (a *myArgs) next() (result string) {
@@ -129,6 +136,8 @@ func newArgs() *myArgs {
for _, a := range os.Args[1:] {
if a == doItFlag {
result.doIt = true
} else if a == localFlag {
result.localFlag = true
} else {
result.args = append(result.args, a)
}
@@ -140,6 +149,7 @@ func Parse() (result *Args, err error) {
result = &Args{}
clArgs := newArgs()
result.doIt = clArgs.doIt
result.localFlag = clArgs.localFlag
result.moduleName = misc.ModuleUnknown
result.conditionalModule = misc.ModuleUnknown