#8 skip path if branch exists #12

Merged
vtolstov merged 90 commits from kgorbunov/pkgdash:master into master 2024-04-03 08:28:17 +03:00
17 changed files with 497 additions and 471 deletions
Showing only changes of commit f1a384c3c4 - Show all commits

View File

@ -1507,10 +1507,10 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_isFunction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/isFunction */ 2971);
function throwError(errorOrErrorFactory, scheduler) {
const errorFactory = (0,_util_isFunction__WEBPACK_IMPORTED_MODULE_0__.isFunction)(errorOrErrorFactory) ? errorOrErrorFactory : () => errorOrErrorFactory;
function throwError(errorOrErroractory, scheduler) {
const Erroractory = (0,_util_isFunction__WEBPACK_IMPORTED_MODULE_0__.isFunction)(errorOrErroractory) ? errorOrErroractory : () => errorOrErroractory;
const init = subscriber => subscriber.error(errorFactory());
const init = subscriber => subscriber.error(Erroractory());
return new _Observable__WEBPACK_IMPORTED_MODULE_1__.Observable(scheduler ? subscriber => scheduler.schedule(init, 0, subscriber) : init);
}
@ -2963,17 +2963,17 @@ __webpack_require__.r(__webpack_exports__);
function throwIfEmpty(errorFactory = defaultErrorFactory) {
function throwIfEmpty(Erroractory = defaultErroractory) {
return (0,_util_lift__WEBPACK_IMPORTED_MODULE_0__.operate)((source, subscriber) => {
let hasValue = false;
source.subscribe(new _OperatorSubscriber__WEBPACK_IMPORTED_MODULE_1__.OperatorSubscriber(subscriber, value => {
hasValue = true;
subscriber.next(value);
}, () => hasValue ? subscriber.complete() : subscriber.error(errorFactory())));
}, () => hasValue ? subscriber.complete() : subscriber.error(Erroractory())));
});
}
function defaultErrorFactory() {
function defaultErroractory() {
return new _util_EmptyError__WEBPACK_IMPORTED_MODULE_2__.EmptyError();
}
@ -67599,19 +67599,19 @@ class EventEmitter_ extends rxjs__WEBPACK_IMPORTED_MODULE_0__.Subject {
subscribe(observerOrNext, error, complete) {
let nextFn = observerOrNext;
let errorFn = error || (() => null);
let Errorn = error || (() => null);
let completeFn = complete;
if (observerOrNext && typeof observerOrNext === 'object') {
const observer = observerOrNext;
nextFn = observer.next?.bind(observer);
errorFn = observer.error?.bind(observer);
Errorn = observer.error?.bind(observer);
completeFn = observer.complete?.bind(observer);
}
if (this.__isAsync) {
errorFn = _wrapInTimeout(errorFn);
Errorn = _wrapInTimeout(Errorn);
if (nextFn) {
nextFn = _wrapInTimeout(nextFn);
@ -67624,7 +67624,7 @@ class EventEmitter_ extends rxjs__WEBPACK_IMPORTED_MODULE_0__.Subject {
const sink = super.subscribe({
next: nextFn,
error: errorFn,
error: Errorn,
complete: completeFn
});

File diff suppressed because one or more lines are too long

View File

@ -56,7 +56,7 @@ func main() {
logger.DefaultLogger = zlogger.NewLogger(zlogger.ReportCaller(), logger.WithLevel(logger.DebugLevel), logger.WithCallerSkipCount(4))
if err := logger.DefaultLogger.Init(); err != nil {
logger.Fatalf(ctx, "failed to init logger")
logger.Fatal(ctx, "failed to init logger")
}
cfg := appconfig.NewConfig(appName, AppVersion) // create new empty config
@ -96,11 +96,11 @@ func main() {
vc,
}, config.LoadOverride(true),
); err != nil {
logger.Fatalf(ctx, "failed to load config: %v", err)
logger.Fatal(ctx, "failed to load config: %v", err)
}
if err := config.Validate(ctx, cfg); err != nil {
logger.Fatalf(ctx, "failed to validate config: %v", err)
logger.Fatal(ctx, "failed to validate config: %v", err)
}
swaggerui.Config["url"] = "../service.swagger.yaml"
@ -119,12 +119,12 @@ func main() {
micro.Name(cfg.Server.Name),
micro.Version(cfg.Server.Version),
); err != nil {
logger.Fatalf(ctx, "failed to init service: %v", err)
logger.Fatal(ctx, "failed to init service: %v", err)
}
assetsUI, err := fs.Sub(assets, "assets/ui")
if err != nil {
logger.Fatalf(ctx, "failed to get assets: %v", err)
logger.Fatal(ctx, "failed to get assets: %v", err)
}
if err := svc.Server("http").Init(
@ -138,26 +138,26 @@ func main() {
httpsrv.PathHandler(http.MethodHead, "/ui/*", spahandler.Handler("/ui/", assetsUI)),
httpsrv.PathHandler(http.MethodGet, "/swagger-ui/*", swaggerui.Handler("/swagger-ui")),
); err != nil {
logger.Fatalf(ctx, "failed to init service: %v", err)
logger.Fatal(ctx, "failed to init service: %v", err)
}
if err := database.ParseDSN(cfg.Database); err != nil {
logger.Fatalf(ctx, "failed to init database: %v", err)
logger.Fatal(ctx, "failed to init database: %v", err)
}
db, err := database.Connect(ctx, cfg.Database, logger.DefaultLogger)
if err != nil {
logger.Fatalf(ctx, "failed to connect database: %v", err)
logger.Fatal(ctx, "failed to connect database: %v", err)
}
store, err := storage.NewStorage(cfg.Database.Type, db)
if err != nil {
logger.Fatalf(ctx, "failed to init storage: %v", err)
logger.Fatal(ctx, "failed to init storage: %v", err)
}
h, err := handler.NewHandler(store)
if err != nil {
logger.Fatalf(ctx, "failed to create handler: %v", err)
logger.Fatal(ctx, "failed to create handler: %v", err)
}
log := logger.NewLogger(
@ -165,11 +165,11 @@ func main() {
logger.WithCallerSkipCount(3),
)
if err := svc.Init(micro.Logger(log)); err != nil {
logger.Fatalf(ctx, "failed to init service: %v", err)
logger.Fatal(ctx, "failed to init service: %v", err)
}
if err := pb.RegisterPkgdashServiceServer(svc.Server("http"), h); err != nil {
logger.Fatalf(ctx, "failed to register handler: %v", err)
logger.Fatal(ctx, "failed to register handler: %v", err)
}
intsvc := httpsrv.NewServer(
@ -179,24 +179,24 @@ func main() {
)
if err := intsvc.Init(); err != nil {
logger.Fatalf(ctx, "failed to init http srv: %v", err)
logger.Fatal(ctx, "failed to init http srv: %v", err)
}
if err := healthhandler.RegisterHealthServiceServer(intsvc, healthhandler.NewHandler()); err != nil {
logger.Fatalf(ctx, "failed to set http handler: %v", err)
logger.Fatal(ctx, "failed to set http handler: %v", err)
}
if err := meterhandler.RegisterMeterServiceServer(intsvc, meterhandler.NewHandler()); err != nil {
logger.Fatalf(ctx, "failed to set http handler: %v", err)
logger.Fatal(ctx, "failed to set http handler: %v", err)
}
if err := intsvc.Start(); err != nil {
logger.Fatalf(ctx, "failed to run http srv: %v", err)
logger.Fatal(ctx, "failed to run http srv: %v", err)
}
cw, err := vc.Watch(ctx, config.WatchCoalesce(true), config.WatchInterval(1*time.Second, 5*time.Second))
if err != nil {
logger.Fatalf(ctx, "failed to watch config: %v", err)
logger.Fatal(ctx, "failed to watch config: %v", err)
}
defer func() {
@ -209,11 +209,11 @@ func main() {
for {
changes, err := cw.Next()
if err != nil {
logger.Errorf(ctx, "failed to get config update: %v", err)
logger.Error(ctx, "failed to get config update: %v", err)
}
for k, v := range changes {
if err = rutil.SetFieldByPath(cfg, v, k); err != nil {
logger.Errorf(ctx, "failed to set config update: %v", err)
logger.Error(ctx, "failed to set config update: %v", err)
break
}
}
@ -222,7 +222,7 @@ func main() {
switch k {
case "Server.LoggerLevel":
if lvl, ok := changes[k].(string); ok {
logger.Infof(ctx, "logger level changed to %s", lvl)
logger.Info(ctx, "logger level changed to %s", lvl)
logger.DefaultLogger.Level(logger.ParseLevel(lvl))
}
}
@ -236,6 +236,6 @@ func main() {
}()
if err = svc.Run(); err != nil {
logger.Fatalf(ctx, "failed to run svc: %v", err)
logger.Fatal(ctx, "failed to run svc: %v", err)
}
}

View File

@ -72,7 +72,7 @@ func main() {
defer cancel()
if err = logger.DefaultLogger.Init(logger.WithCallerSkipCount(3)); err != nil {
logger.Errorf(ctx, "logger init error: %v", err)
logger.Error(ctx, "logger init error: %v", err)
}
cfg := configcli.NewConfig()
@ -88,7 +88,7 @@ func main() {
},
config.LoadOverride(true),
); err != nil {
logger.Fatalf(ctx, "failed to load config: %v", err)
logger.Fatal(ctx, "failed to load config: %v", err)
}
for _, configDir := range configDirs {
@ -100,23 +100,23 @@ func main() {
fileconfig.Path(filepath.Join(configDir, configFile)),
)
if err = c.Load(ctx, config.LoadOverride(true)); err != nil {
logger.Fatalf(ctx, "failed to load config: %v", err)
logger.Fatal(ctx, "failed to load config: %v", err)
}
}
}
file, err := os.Open(".gitea/pkgdashcli.yaml")
if err != nil {
logger.Fatalf(ctx, "file open: %s", err)
logger.Fatal(ctx, "file open: %s", err)
}
defer file.Close()
d := yaml.NewDecoder(file)
if err = d.Decode(&cfg); err != nil {
logger.Fatalf(ctx, "Decode err: %s", d)
logger.Fatal(ctx, "Decode err: %s", d)
}
logger.Infof(ctx, "Load config... %s", cfg)
logger.Info(ctx, "Load config... %s", cfg)
if cfg.PullRequestBody == "" {
cfg.PullRequestBody = DefaultPullRequestBody
@ -154,7 +154,7 @@ func main() {
OnUpdate: func(u modules.Update) {
var modpath string // new mod path with major
if u.Err != nil {
logger.Errorf(ctx, "%s: failed: %v", u.Module.Path, u.Err)
logger.Error(ctx, "%s: failed: %v", u.Module.Path, u.Err)
return
}
modpath = u.Module.Path
@ -185,17 +185,17 @@ func main() {
} else {
repoGit = getRepoMgmt()
if repoGit == "unknown" {
logger.Fatalf(ctx, "pkgdash/main failed to get repo management")
logger.Fatal(ctx, "pkgdash/main failed to get repo management")
}
}
usr, err := user.Current()
if err != nil {
logger.Errorf(ctx, "pkgdash/main can t get info user: %s", err)
logger.Error(ctx, "pkgdash/main can t get info user: %s", err)
} else {
n, err := netrc.Parse(filepath.Join(usr.HomeDir, ".netrc"))
if err != nil {
logger.Errorf(ctx, "pkgdash/main can t parse .netrc: %s", err)
logger.Error(ctx, "pkgdash/main can t parse .netrc: %s", err)
}
tokenGit = n.Machine(repoGit).Get("password")
}
@ -207,21 +207,21 @@ func main() {
}
}*/
logger.Infof(ctx, "cfg: %v", cfg)
logger.Info(ctx, "cfg: %v", cfg)
gitSource := source.NewSourceControl(*cfg)
for _, branch := range cfg.Branches {
for pathMod, mod := range mvs {
err = gitSource.RequestOpen(ctx, branch, pathMod, mod)
if err != nil {
logger.Errorf(ctx, "failed to create pr: %v", err)
logger.Error(ctx, "failed to create pr: %v", err)
}
logger.Infof(ctx, "PR create for %s - %s", pathMod, mod.Version)
logger.Info(ctx, "PR create for %s - %s", pathMod, mod.Version)
}
}
if err != nil {
logger.Fatalf(ctx, "failed to create pr: %v", err)
logger.Fatal(ctx, "failed to create pr: %v", err)
}
}
@ -256,34 +256,34 @@ func giteaPullRequest(ctx context.Context, cfg *configcli.Config, branch string,
tplTitle, err := template.New("pull_request_title").Parse(cfg.PullRequestTitle)
if err != nil {
logger.Fatalf(ctx, "failed to parse template: %v", err)
logger.Fatal(ctx, "failed to parse template: %v", err)
}
wTitle := bytes.NewBuffer(nil)
tplBody, err := template.New("pull_request_body").Parse(cfg.PullRequestBody)
if err != nil {
logger.Fatalf(ctx, "failed to parse template: %v", err)
logger.Fatal(ctx, "failed to parse template: %v", err)
}
wBody := bytes.NewBuffer(nil)
repo, err := git.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
if err != nil {
logger.Fatalf(ctx, "failed to open repo: %v", err)
logger.Fatal(ctx, "failed to open repo: %v", err)
}
if err = repo.FetchContext(ctx, &git.FetchOptions{
Auth: &httpauth.BasicAuth{Username: envTOKEN, Password: envTOKEN},
Force: true,
}); err != nil && err != git.NoErrAlreadyUpToDate {
logger.Fatalf(ctx, "failed to fetch repo: %v", err)
logger.Fatal(ctx, "failed to fetch repo: %v", err)
}
var headRef *plumbing.Reference
refIter, err := repo.Branches()
if err != nil {
logger.Fatalf(ctx, "failed to get branches: %v", err)
logger.Fatal(ctx, "failed to get branches: %v", err)
}
for {
ref, err := refIter.Next()
@ -298,14 +298,14 @@ func giteaPullRequest(ctx context.Context, cfg *configcli.Config, branch string,
refIter.Close()
if headRef == nil {
logger.Fatalf(ctx, "failed to get repo branch head")
logger.Fatal(ctx, "failed to get repo branch head")
}
logger.Infof(ctx, "repo head %s", headRef)
logger.Info(ctx, "repo head %s", headRef)
wtree, err := repo.Worktree()
if err != nil {
logger.Fatalf(ctx, "failed to get worktree: %v", err)
logger.Fatal(ctx, "failed to get worktree: %v", err)
}
type giteaPull struct {
@ -336,13 +336,13 @@ func giteaPullRequest(ctx context.Context, cfg *configcli.Config, branch string,
}
if err = json.Unmarshal(buf, &pulls); err != nil {
logger.Fatalf(ctx, "failed to decode response %s err: %v", buf, err)
logger.Fatal(ctx, "failed to decode response %s err: %v", buf, err)
}
for path := range mods {
for _, pull := range pulls {
if strings.Contains(pull.Title, path) && pull.Base.Ref == branch {
logger.Infof(ctx, "skip %s as pr already exists %s", path, pull.URL)
logger.Info(ctx, "skip %s as pr already exists %s", path, pull.URL)
delete(mods, path)
}
}
@ -352,11 +352,11 @@ func giteaPullRequest(ctx context.Context, cfg *configcli.Config, branch string,
wTitle.Reset()
wBody.Reset()
logger.Infof(ctx, "update %s from %s to %s", path, mod.Module.Version, mod.Version)
logger.Info(ctx, "update %s from %s to %s", path, mod.Module.Version, mod.Version)
logger.Infof(ctx, "reset worktree")
logger.Info(ctx, "reset worktree")
if err = wtree.Reset(&git.ResetOptions{Mode: git.HardReset}); err != nil {
logger.Fatalf(ctx, "failed to reset repo branch: %v", err)
logger.Fatal(ctx, "failed to reset repo branch: %v", err)
}
if err = wtree.PullContext(ctx, &git.PullOptions{
@ -366,17 +366,17 @@ func giteaPullRequest(ctx context.Context, cfg *configcli.Config, branch string,
Force: true,
RemoteName: "origin",
}); err != nil && err != git.NoErrAlreadyUpToDate {
logger.Fatalf(ctx, "failed to pull repo: %v", err)
logger.Fatal(ctx, "failed to pull repo: %v", err)
}
logger.Infof(ctx, "checkout ref %s", headRef)
logger.Info(ctx, "checkout ref %s", headRef)
if err = wtree.Checkout(&git.CheckoutOptions{
Hash: headRef.Hash(),
Branch: plumbing.NewBranchReferenceName(fmt.Sprintf("pkgdash/go_modules/%s-%s", path, mod.Version)),
Create: true,
Force: true,
}); err != nil {
logger.Fatalf(ctx, "failed to checkout tree: %v", err)
logger.Fatal(ctx, "failed to checkout tree: %v", err)
}
epath, err := exec.LookPath("go")
@ -384,7 +384,7 @@ func giteaPullRequest(ctx context.Context, cfg *configcli.Config, branch string,
err = nil
}
if err != nil {
logger.Fatalf(ctx, "failed to find go command: %v", err)
logger.Fatal(ctx, "failed to find go command: %v", err)
}
var cmd *exec.Cmd
@ -392,25 +392,25 @@ func giteaPullRequest(ctx context.Context, cfg *configcli.Config, branch string,
cmd = exec.CommandContext(ctx, epath, "mod", "edit", fmt.Sprintf("-require=%s@%s", path, mod.Version))
if out, err = cmd.CombinedOutput(); err != nil {
logger.Fatalf(ctx, "failed to run go mod edit: %s err: %v", out, err)
logger.Fatal(ctx, "failed to run go mod edit: %s err: %v", out, err)
}
cmd = exec.CommandContext(ctx, epath, "mod", "tidy")
if out, err = cmd.CombinedOutput(); err != nil {
logger.Fatalf(ctx, "failed to run go mod tidy: %s err: %v", out, err)
logger.Fatal(ctx, "failed to run go mod tidy: %s err: %v", out, err)
}
logger.Infof(ctx, "worktree add go.mod")
logger.Info(ctx, "worktree add go.mod")
if _, err = wtree.Add("go.mod"); err != nil {
logger.Fatalf(ctx, "failed to add file: %v", err)
logger.Fatal(ctx, "failed to add file: %v", err)
}
logger.Infof(ctx, "worktree add go.sum")
logger.Info(ctx, "worktree add go.sum")
if _, err = wtree.Add("go.sum"); err != nil {
logger.Fatalf(ctx, "failed to add file: %v", err)
logger.Fatal(ctx, "failed to add file: %v", err)
}
logger.Infof(ctx, "worktree commit")
logger.Info(ctx, "worktree commit")
_, err = wtree.Commit(wTitle.String(), &git.CommitOptions{
Parents: []plumbing.Hash{headRef.Hash()},
Author: &object.Signature{
@ -420,27 +420,27 @@ func giteaPullRequest(ctx context.Context, cfg *configcli.Config, branch string,
},
})
if err != nil {
logger.Fatalf(ctx, "failed to commit: %v", err)
logger.Fatal(ctx, "failed to commit: %v", err)
}
// newref := plumbing.NewHashReference(plumbing.ReferenceName(fmt.Sprintf("refs/heads/pkgdash/go_modules/%s-%s", path, mod.Version)), headRef.Hash())
/*
if err = repo.Storer.SetReference(newref); err != nil {
logger.Fatalf(ctx, "failed to create repo branch: %v", err)
logger.Fatal(ctx, "failed to create repo branch: %v", err)
}
*/
refspec := gitconfig.RefSpec(fmt.Sprintf("+refs/heads/pkgdash/go_modules/%s-%s:refs/heads/pkgdash/go_modules/%s-%s", path, mod.Version, path, mod.Version))
logger.Infof(ctx, "try to push refspec %s", refspec)
logger.Info(ctx, "try to push refspec %s", refspec)
if err = repo.PushContext(ctx, &git.PushOptions{
RefSpecs: []gitconfig.RefSpec{refspec},
Auth: &httpauth.BasicAuth{Username: envTOKEN, Password: envTOKEN},
Force: true,
}); err != nil {
logger.Fatalf(ctx, "failed to push repo branch: %v", err)
logger.Fatal(ctx, "failed to push repo branch: %v", err)
}
data := map[string]string{
@ -450,10 +450,10 @@ func giteaPullRequest(ctx context.Context, cfg *configcli.Config, branch string,
}
if err = tplTitle.Execute(wTitle, data); err != nil {
logger.Fatalf(ctx, "failed to execute template: %v", err)
logger.Fatal(ctx, "failed to execute template: %v", err)
}
if err = tplBody.Execute(wBody, data); err != nil {
logger.Fatalf(ctx, "failed to execute template: %v", err)
logger.Fatal(ctx, "failed to execute template: %v", err)
}
body := map[string]string{
@ -462,14 +462,14 @@ func giteaPullRequest(ctx context.Context, cfg *configcli.Config, branch string,
"head": fmt.Sprintf("pkgdash/go_modules/%s-%s", path, mod.Version),
"title": wTitle.String(),
}
logger.Infof(ctx, "raw body: %#+v", body)
logger.Info(ctx, "raw body: %#+v", body)
buf, err = json.Marshal(body)
if err != nil {
return err
}
logger.Infof(ctx, "marshal body: %s", buf)
logger.Info(ctx, "marshal body: %s", buf)
req, err := http.NewRequestWithContext(ctx, http.MethodPost, envAPIURL+"/repos/"+envREPOSITORY+"/pulls?token="+envTOKEN, bytes.NewReader(buf))
if err != nil {

32
go.mod
View File

@ -3,10 +3,10 @@ module git.unistack.org/unistack-org/pkgdash
go 1.20
require (
github.com/envoyproxy/protoc-gen-validate v1.0.2
github.com/envoyproxy/protoc-gen-validate v1.0.4
github.com/go-git/go-git/v5 v5.8.1
github.com/golang-migrate/migrate/v4 v4.15.1
github.com/google/uuid v1.3.0
github.com/google/uuid v1.6.0
github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c
github.com/jmoiron/sqlx v1.3.1
github.com/pkg/errors v0.9.1
@ -15,23 +15,29 @@ require (
go.unistack.org/micro-codec-jsonpb/v4 v4.0.0
go.unistack.org/micro-codec-yaml/v4 v4.0.0
go.unistack.org/micro-config-env/v4 v4.0.1
go.unistack.org/micro-config-file/v4 v4.0.1
go.unistack.org/micro-config-vault/v4 v4.0.2
go.unistack.org/micro-logger-zerolog/v4 v4.0.3
go.unistack.org/micro-meter-victoriametrics/v4 v4.0.1
go.unistack.org/micro-proto/v4 v4.0.1
go.unistack.org/micro-server-http/v4 v4.0.13
go.unistack.org/micro/v4 v4.0.7
go.unistack.org/micro/v4 v4.0.18
go.unistack.org/protoc-gen-go-micro/v4 v4.0.7
golang.org/x/mod v0.14.0
golang.org/x/sync v0.6.0
google.golang.org/protobuf v1.31.0
google.golang.org/protobuf v1.33.0
gopkg.in/yaml.v2 v2.4.0
modernc.org/sqlite v1.21.0
)
require (
dario.cat/mergo v1.0.0
github.com/google/go-cmp v0.6.0 // indirect
github.com/silas/dag v0.0.0-20220518035006-a7e85ada93c5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240311132316-a219d84964c2 // indirect
google.golang.org/grpc v1.62.1 // indirect
)
require (
dario.cat/mergo v1.0.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect
github.com/VictoriaMetrics/metrics v1.24.0 // indirect
@ -45,7 +51,7 @@ require (
github.com/go-git/go-billy/v5 v5.4.1 // indirect
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
@ -57,7 +63,7 @@ require (
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/vault/api v1.9.2 // indirect
github.com/iancoleman/strcase v0.2.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530 // indirect
@ -83,15 +89,15 @@ require (
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/skeema/knownhosts v1.2.0 // indirect
github.com/spf13/afero v1.3.3 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/valyala/fastrand v1.1.0 // indirect
github.com/valyala/histogram v1.2.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
go.uber.org/atomic v1.6.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.16.0 // indirect
go.unistack.org/micro-config-file/v4 v4.0.3
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.17.0 // indirect

72
go.sum
View File

@ -4,6 +4,7 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
@ -16,6 +17,7 @@ cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOY
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=
cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=
cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY=
cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg=
cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8=
cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0=
@ -41,6 +43,7 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
@ -352,8 +355,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA=
github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE=
github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A=
github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew=
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
@ -495,8 +498,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
@ -518,7 +521,8 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github/v35 v35.2.0/go.mod h1:s0515YVTI+IMrDoy9Y4pHt9ShGpzHvHO8rZ7L7acgvs=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
@ -536,6 +540,7 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
@ -547,11 +552,13 @@ github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
@ -600,8 +607,8 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T
github.com/hashicorp/vault/api v1.9.2 h1:YjkZLJ7K3inKgMZ0wzCU9OHqc+UqMQyXsPXnf3Cl2as=
github.com/hashicorp/vault/api v1.9.2/go.mod h1:jo5Y/ET+hNyz+JnKDt8XLAdKs+AM0G5W0Vp1IrFI8N8=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
@ -878,7 +885,7 @@ github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
@ -943,6 +950,8 @@ github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhr
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/silas/dag v0.0.0-20220518035006-a7e85ada93c5 h1:G/FZtUu7a6NTWl3KUHMV9jkLAh/Rvtf03NWMHaEDl+E=
github.com/silas/dag v0.0.0-20220518035006-a7e85ada93c5/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
@ -962,8 +971,8 @@ github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4k
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/afero v1.3.3 h1:p5gZEKLYoL7wh8VrJesMaYeNxdEd1v3cb4irOk9zB54=
github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4=
github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY=
github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
@ -1073,8 +1082,8 @@ go.unistack.org/micro-codec-yaml/v4 v4.0.0 h1:DK/+fA69gmnvYmGHe3kqVR0pukS8ank5lP
go.unistack.org/micro-codec-yaml/v4 v4.0.0/go.mod h1:UG4ouILbUfgNL7nvp7CpmD2IIzO8bQHjzDIahOvIAgM=
go.unistack.org/micro-config-env/v4 v4.0.1 h1:A7W+Xm4WEsN9O6isWncfwNWEUuSuCHgt+aovpZ4XhuE=
go.unistack.org/micro-config-env/v4 v4.0.1/go.mod h1:kJvyLrRbVRrsM1jTdl5lHy4u88PnlK2mskOZ3T57M/0=
go.unistack.org/micro-config-file/v4 v4.0.1 h1:J8CNyOvxfL4CnoL2xocvyWHo77UWF8wvH4To23E0gOA=
go.unistack.org/micro-config-file/v4 v4.0.1/go.mod h1:OSfm+CIjAgb0HRlXCZd0DUtDwV5zJKXMHduSiGsSY0M=
go.unistack.org/micro-config-file/v4 v4.0.3 h1:1zUZWnzgf+iB8qbh6kOlA/iBUhDSByp2rKXwxn1yUFM=
go.unistack.org/micro-config-file/v4 v4.0.3/go.mod h1:9MbYnGXnsrzvjxAPKutxCgxZxPYOUO/XBLW08aN8zD8=
go.unistack.org/micro-config-vault/v4 v4.0.2 h1:QhDdtVJhQYmJZqAhsLRdnDZSZSzBunWX9a5l/WNKWNY=
go.unistack.org/micro-config-vault/v4 v4.0.2/go.mod h1:0gWQVkncMwaG0wZPqC98HhS6AYOcXR0lmPG/roR6AcM=
go.unistack.org/micro-logger-zerolog/v4 v4.0.3 h1:ao6jGMo8jJG9WcOE738eqrWeabQaqpHMrLx+IniRDpI=
@ -1085,8 +1094,10 @@ go.unistack.org/micro-proto/v4 v4.0.1 h1:2RKHgtCOOcAFgKsnngGK5bqM/6MWXOjVCdw03db
go.unistack.org/micro-proto/v4 v4.0.1/go.mod h1:ArmK7o+uFvxSY3dbJhKBBX4Pm1rhWdLEFf3LxBrMtec=
go.unistack.org/micro-server-http/v4 v4.0.13 h1:/EUEE32ddsNH9qbBilg2cdnnMWXPOyL6TfG++Las4E4=
go.unistack.org/micro-server-http/v4 v4.0.13/go.mod h1:mQ18qN/1PxeTCKMNslh5qgswV582DP9QnsaI/ohFo/k=
go.unistack.org/micro/v4 v4.0.7 h1:2lwtZlHcSwgkahhFbkI4x1lOS79lw8uLHtcEhlFF+AM=
go.unistack.org/micro/v4 v4.0.7/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk=
go.unistack.org/micro/v4 v4.0.17 h1:mF7uM+J4ILdG+1fcwzKYCwDlxhdbF/e1WnGzKKLnIXc=
go.unistack.org/micro/v4 v4.0.17/go.mod h1:ZDgU9931vm2l7X6RN/6UuwRIVp24GRdmQ7dKmegArk4=
go.unistack.org/micro/v4 v4.0.18 h1:b7WFwem8Nz1xBrRg5FeLnm9CE5gJseHyf9j0BhkiXW0=
go.unistack.org/micro/v4 v4.0.18/go.mod h1:5+da5r835gP0WnNZbYUJDCvWpJ9Xc3IEGyp62e8o8R4=
go.unistack.org/protoc-gen-go-micro/v4 v4.0.7 h1:c3CeBvjWV9MBrGGPaQCcHZrnuLY9sVJHv7vACI/dvuM=
go.unistack.org/protoc-gen-go-micro/v4 v4.0.7/go.mod h1:9bsKAlESlPXPBSmY/NDLL//smZbhnEMrnWyG+M8zVFA=
golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
@ -1110,15 +1121,17 @@ golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@ -1231,8 +1244,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@ -1343,6 +1356,7 @@ golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -1350,6 +1364,7 @@ golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@ -1369,15 +1384,15 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE=
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -1464,6 +1479,7 @@ golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
@ -1560,8 +1576,10 @@ google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210207032614-bba0dbe2a9ea/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
@ -1578,7 +1596,8 @@ google.golang.org/genproto v0.0.0-20210721163202-f1cecdd8b78a/go.mod h1:ob2IJxKr
google.golang.org/genproto v0.0.0-20210726143408-b02e89920bf0/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240311132316-a219d84964c2 h1:9IZDv+/GcI6u+a4jRFRLxQs0RUCfavGfoOgEW6jpkI0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240311132316-a219d84964c2/go.mod h1:UCOku4NytXMJuLQE5VuqA5lX3PcHCBo8pxNyvkf4xBs=
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
@ -1608,7 +1627,8 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ
google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k=
google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag=
google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk=
google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
@ -1623,8 +1643,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

View File

@ -80,7 +80,7 @@ func ParseDSN(cfg *appconfig.DatabaseConfig) error {
case "sqlite", "sqlite3":
u.Scheme = "sqlite"
default:
return fmt.Errorf("unknown database %s", u.Scheme)
return fmt.Error("unknown database %s", u.Scheme)
}
cfg.Type = u.Scheme
@ -95,7 +95,7 @@ func connect(ctx context.Context, cfg *appconfig.DatabaseConfig, log logger.Logg
var db *sqlx.DB
var err error
log.Infof(ctx, "connect to %s", cfg.Type)
log.Info(ctx, "connect to %s", cfg.Type)
switch cfg.Type {
case "postgres", "pgsql", "postgresql":
db, err = connectPostgres(ctx, cfg.ConnStr)
@ -104,7 +104,7 @@ func connect(ctx context.Context, cfg *appconfig.DatabaseConfig, log logger.Logg
db, err = connectSqlite(ctx, cfg.ConnStr)
cfg.Type = "sqlite"
default:
return nil, fmt.Errorf("unknown database type %s", cfg.Type)
return nil, fmt.Error("unknown database type %s", cfg.Type)
}
if err != nil {
@ -128,18 +128,18 @@ func Connect(ctx context.Context, cfg *appconfig.DatabaseConfig, log logger.Logg
case "":
break
case "up":
logger.Infof(ctx, "migrate up")
logger.Info(ctx, "migrate up")
err = m.Up()
case "down":
logger.Infof(ctx, "migrate down")
logger.Info(ctx, "migrate down")
err = m.Down()
case "seed":
logger.Infof(ctx, "migrate seed")
logger.Info(ctx, "migrate seed")
if err = m.Drop(); err == nil {
err = m.Up()
}
default:
logger.Infof(ctx, "migrate version")
logger.Info(ctx, "migrate version")
v, verr := strconv.ParseUint(cfg.Type, 10, 64)
if verr != nil {
return nil, err
@ -249,5 +249,5 @@ func (l *mLog) Verbose() bool {
}
func (l *mLog) Printf(format string, v ...interface{}) {
l.l.Infof(l.ctx, format, v...)
l.l.Info(l.ctx, format, v...)
}

View File

@ -15,7 +15,7 @@ func (h *Handler) HandlerList(ctx context.Context, req *pb.HandlerListReq, rsp *
packages, err := h.store.HandlerList(ctx, req)
if err != nil {
logger.Errorf(ctx, "error db response: %v", err)
logger.Error(ctx, "error db response: %v", err)
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
return httpsrv.SetError(NewInternalError(err))
}

View File

@ -15,7 +15,7 @@ func (h *Handler) PackageList(ctx context.Context, req *pb.PackageListReq, rsp *
packages, err := h.store.PackageList(ctx, req)
if err != nil {
logger.Errorf(ctx, "error db response: %v", err)
logger.Error(ctx, "error db response: %v", err)
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
return httpsrv.SetError(NewInternalError(err))
}

View File

@ -15,7 +15,7 @@ func (h *Handler) PackageModules(ctx context.Context, req *pb.PackageModulesReq,
modules, err := h.store.PackageModules(ctx, req)
if err != nil {
logger.Errorf(ctx, "error db response: %v", err)
logger.Error(ctx, "error db response: %v", err)
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
return httpsrv.SetError(NewInternalError(err))
}

View File

@ -145,7 +145,7 @@ func Query(modpath string, cached bool) (*Module, bool, error) {
if msg == "" {
msg = res.Status
}
return nil, false, fmt.Errorf("proxy: %s", msg)
return nil, false, fmt.Error("proxy: %s", msg)
}
var mod Module
mod.Path = modpath
@ -168,7 +168,7 @@ func Latest(modpath string, cached bool) (*Module, error) {
return nil, err
}
if !ok {
return nil, fmt.Errorf("module not found: %s", modpath)
return nil, fmt.Error("module not found: %s", modpath)
}
for i := 0; i < 100; i++ {
nextpath, ok := latest.NextMajorPath()
@ -198,7 +198,7 @@ func Latest(modpath string, cached bool) (*Module, error) {
}
latest = next
}
return nil, fmt.Errorf("request limit exceeded")
return nil, fmt.Error("request limit exceeded")
}
// QueryPackage tries to find the module path for the provided package path
@ -218,9 +218,9 @@ func QueryPackage(pkgpath string, cached bool) (*Module, error) {
if major, ok := ModMajor(modpath); ok {
if v := mod.MaxVersion(major, false); v != "" {
spec := JoinPath(modprefix, "", pkgdir) + "@" + v
return nil, fmt.Errorf("%s doesn't support import versioning; use %s", major, spec)
return nil, fmt.Error("%s doesn't support import versioning; use %s", major, spec)
}
return nil, fmt.Errorf("failed to find module for package: %s", pkgpath)
return nil, fmt.Error("failed to find module for package: %s", pkgpath)
}
}
return mod, nil
@ -232,7 +232,7 @@ func QueryPackage(pkgpath string, cached bool) (*Module, error) {
}
prefix = strings.TrimSuffix(remaining, "/")
}
return nil, fmt.Errorf("failed to find module for package: %s", pkgpath)
return nil, fmt.Error("failed to find module for package: %s", pkgpath)
}
// Update reports a newer version of a module.

View File

@ -108,7 +108,7 @@ func FindModFile(dir string) (string, error) {
}
parent := filepath.Dir(dir)
if parent == dir {
return "", fmt.Errorf("cannot find go.mod")
return "", fmt.Error("cannot find go.mod")
}
dir = parent
}

View File

@ -45,10 +45,10 @@ func TestModMajor(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
got, got1 := ModMajor(tt.args.modpath)
if got != tt.want {
t.Errorf("ModMajor() got = %v, want %v", got, tt.want)
t.Error("ModMajor() got = %v, want %v", got, tt.want)
}
if got1 != tt.want1 {
t.Errorf("ModMajor() got1 = %v, want %v", got1, tt.want1)
t.Error("ModMajor() got1 = %v, want %v", got1, tt.want1)
}
})
}

View File

@ -67,14 +67,14 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
// создания шаблона названия для пулл реквеста
tplTitle, err := template.New("pull_request_title").Parse(g.PRTitle)
if err != nil {
logger.Fatalf(ctx, "failed to parse template: %v", err)
logger.Fatal(ctx, "failed to parse template: %v", err)
}
wTitle := bytes.NewBuffer(nil)
// создания шаблона тела для пулл реквеста
tplBody, err := template.New("pull_request_body").Parse(g.PRTitle)
if err != nil {
logger.Fatalf(ctx, "failed to parse template: %v", err)
logger.Fatal(ctx, "failed to parse template: %v", err)
}
wBody := bytes.NewBuffer(nil)
@ -86,29 +86,29 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
}
if err = tplTitle.Execute(wTitle, data); err != nil {
logger.Fatalf(ctx, "failed to execute template: %v", err)
logger.Fatal(ctx, "failed to execute template: %v", err)
}
if err = tplBody.Execute(wBody, data); err != nil {
logger.Fatalf(ctx, "failed to execute template: %v", err)
logger.Fatal(ctx, "failed to execute template: %v", err)
}
// открытие гит репозитория с опцией обхода репозитория для нахождения .git
repo, err := git.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
if err != nil {
logger.Fatalf(ctx, "failed to open repo: %v", err)
logger.Fatal(ctx, "failed to open repo: %v", err)
}
//извлекаем ссылки с объектами из удаленного объекта??
if err = repo.FetchContext(ctx, &git.FetchOptions{
Auth: &httpauth.BasicAuth{Username: g.Token, Password: g.Token},
Force: true,
}); err != nil && err != git.NoErrAlreadyUpToDate {
logger.Fatalf(ctx, "failed to fetch repo: %v", err)
logger.Fatal(ctx, "failed to fetch repo: %v", err)
} //обновляем репозиторий
var headRef *plumbing.Reference // вроде ссылка на гит
refIter, err := repo.Branches() //получение веток
if err != nil {
logger.Fatalf(ctx, "failed to get branches: %v", err)
logger.Fatal(ctx, "failed to get branches: %v", err)
}
for {
ref, err := refIter.Next()
@ -123,14 +123,14 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
refIter.Close()
if headRef == nil {
logger.Fatalf(ctx, "failed to get repo branch head")
logger.Fatal(ctx, "failed to get repo branch head")
} // Не получили нужную ветку
logger.Infof(ctx, "repo head %s", headRef)
logger.Info(ctx, "repo head %s", headRef)
wtree, err := repo.Worktree() //todo вроде рабочее дерево не нужно
if err != nil {
logger.Fatalf(ctx, "failed to get worktree: %v", err)
logger.Fatal(ctx, "failed to get worktree: %v", err)
}
var pulls []*giteaPull
@ -155,28 +155,28 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
switch rsp.StatusCode {
case http.StatusOK:
if err = json.Unmarshal(buf, &pulls); err != nil {
logger.Fatalf(ctx, "failed to decode response %s err: %v", buf, err)
logger.Fatal(ctx, "failed to decode response %s err: %v", buf, err)
} // записываем ответ от гита по пулл реквестам, видимо существующим
// перебираем наши модификации и если они уже есть в гите удаляем их из mods
for _, pull := range pulls {
if strings.Contains(pull.Title, path) && pull.Base.Ref == branch {
logger.Infof(ctx, "skip %s as pr already exists %s", path, pull.URL)
logger.Info(ctx, "skip %s as pr already exists %s", path, pull.URL)
return ErrPRExist
} // хотим проверить есть ли пулл реквест для этой ветки, если есть то выходим
}
case http.StatusNotFound:
logger.Infof(ctx, "PL is not exist for %s", g.Repository)
logger.Info(ctx, "PL is not exist for %s", g.Repository)
default:
return fmt.Errorf("unknown error: %s", buf)
}
logger.Infof(ctx, "update %s from %s to %s", path, mod.Module.Version, mod.Version)
logger.Info(ctx, "update %s from %s to %s", path, mod.Module.Version, mod.Version)
logger.Infof(ctx, "reset worktree")
logger.Info(ctx, "reset worktree")
if err = wtree.Reset(&git.ResetOptions{Mode: git.HardReset}); err != nil {
logger.Fatalf(ctx, "failed to reset repo branch: %v", err)
logger.Fatal(ctx, "failed to reset repo branch: %v", err)
} //вроде меняем ветку todo вроде можно удалить
if err = wtree.PullContext(ctx, &git.PullOptions{
@ -186,17 +186,17 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
Force: true,
RemoteName: "origin",
}); err != nil && err != git.NoErrAlreadyUpToDate {
logger.Fatalf(ctx, "failed to pull repo: %v", err) //подтягиваем изменения с удаленого репозитория
logger.Fatal(ctx, "failed to pull repo: %v", err) //подтягиваем изменения с удаленого репозитория
}
logger.Infof(ctx, "checkout ref %s", headRef)
logger.Info(ctx, "checkout ref %s", headRef)
if err = wtree.Checkout(&git.CheckoutOptions{
Hash: headRef.Hash(),
Branch: plumbing.NewBranchReferenceName(fmt.Sprintf("pkgdash/go_modules/%s-%s", path, mod.Version)),
Create: true,
Force: true,
}); err != nil {
logger.Fatalf(ctx, "failed to checkout tree: %v", err)
logger.Fatal(ctx, "failed to checkout tree: %v", err)
} //создаем новую ветку
epath, err := exec.LookPath("go")
@ -204,7 +204,7 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
err = nil
}
if err != nil {
logger.Fatalf(ctx, "failed to find go command: %v", err)
logger.Fatal(ctx, "failed to find go command: %v", err)
} // ищем go файл
var cmd *exec.Cmd
@ -212,30 +212,30 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
cmd = exec.CommandContext(ctx, epath, "mod", "edit", fmt.Sprintf("-droprequire=%s", mod.Module.Path))
if out, err = cmd.CombinedOutput(); err != nil {
logger.Fatalf(ctx, "failed to run go mod edit: %s err: %v", out, err)
logger.Fatal(ctx, "failed to run go mod edit: %s err: %v", out, err)
}
cmd = exec.CommandContext(ctx, epath, "mod", "edit", fmt.Sprintf("-require=%s@%s", path, mod.Version))
if out, err = cmd.CombinedOutput(); err != nil {
logger.Fatalf(ctx, "failed to run go mod edit: %s err: %v", out, err)
logger.Fatal(ctx, "failed to run go mod edit: %s err: %v", out, err)
} // пытаемся выполнить команду go mod edit с новой версией модуля
cmd = exec.CommandContext(ctx, epath, "mod", "tidy")
if out, err = cmd.CombinedOutput(); err != nil {
logger.Fatalf(ctx, "failed to run go mod tidy: %s err: %v", out, err)
logger.Fatal(ctx, "failed to run go mod tidy: %s err: %v", out, err)
} // пытаемся выполнить команду go mod tidy пытаемся подтянуть новую версию модуля
logger.Infof(ctx, "worktree add go.mod")
logger.Info(ctx, "worktree add go.mod")
if _, err = wtree.Add("go.mod"); err != nil {
logger.Fatalf(ctx, "failed to add file: %v", err)
logger.Fatal(ctx, "failed to add file: %v", err)
}
logger.Infof(ctx, "worktree add go.sum")
logger.Info(ctx, "worktree add go.sum")
if _, err = wtree.Add("go.sum"); err != nil {
logger.Fatalf(ctx, "failed to add file: %v", err)
logger.Fatal(ctx, "failed to add file: %v", err)
}
logger.Infof(ctx, "worktree commit")
logger.Info(ctx, "worktree commit")
_, err = wtree.Commit(wTitle.String(), &git.CommitOptions{
Parents: []plumbing.Hash{headRef.Hash()},
Author: &object.Signature{
@ -245,43 +245,43 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
},
}) // хотим за коммитить изменения
if err != nil {
logger.Fatalf(ctx, "failed to commit: %v", err)
logger.Fatal(ctx, "failed to commit: %v", err)
}
// newref := plumbing.NewHashReference(plumbing.ReferenceName(fmt.Sprintf("refs/heads/pkgdash-1/go_modules/%s-%s", path, mod.Version)), headRef.Hash())
/*
if err = repo.Storer.SetReference(newref); err != nil {
logger.Fatalf(ctx, "failed to create repo branch: %v", err)
logger.Fatal(ctx, "failed to create repo branch: %v", err)
}
*/
refspec := gitconfig.RefSpec(fmt.Sprintf("+refs/heads/pkgdash/go_modules/%s-%s:refs/heads/pkgdash/go_modules/%s-%s", path, mod.Version, path, mod.Version)) //todo как будто нужно переделать
logger.Infof(ctx, "try to push refspec %s", refspec)
logger.Info(ctx, "try to push refspec %s", refspec)
if err = repo.PushContext(ctx, &git.PushOptions{
RefSpecs: []gitconfig.RefSpec{refspec},
Auth: &httpauth.BasicAuth{Username: g.Token, Password: g.Token},
Force: true,
}); err != nil {
logger.Fatalf(ctx, "failed to push repo branch: %v", err)
logger.Fatal(ctx, "failed to push repo branch: %v", err)
} // пытаемся за пушить изменения
body := map[string]string{
"base": "develop",
"base": branch,
"body": wBody.String(),
"head": fmt.Sprintf("pkgdash/go_modules/%s-%s", path, mod.Version),
"title": wTitle.String(),
}
logger.Infof(ctx, "raw body: %#+v", body)
logger.Info(ctx, "raw body: %#+v", body)
buf, err = json.Marshal(body)
if err != nil {
return err
}
logger.Infof(ctx, "marshal body: %s", buf)
logger.Info(ctx, "marshal body: %s", buf)
req, err = http.NewRequestWithContext(
ctx,
@ -325,20 +325,20 @@ func (g *Gitea) RequestClose(ctx context.Context, cfg *configcli.Config, branch
repo, err := git.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
if err != nil {
logger.Fatalf(ctx, "failed to open repo: %v", err)
logger.Fatal(ctx, "failed to open repo: %v", err)
}
//извлекаем ссылки с объектами из удаленного объекта??
if err = repo.FetchContext(ctx, &git.FetchOptions{
Auth: &httpauth.BasicAuth{Username: cfg.Source.Token, Password: cfg.Source.Token},
Force: true,
}); err != nil && err != git.NoErrAlreadyUpToDate {
logger.Fatalf(ctx, "failed to fetch repo: %v", err)
logger.Fatal(ctx, "failed to fetch repo: %v", err)
}
var headRef *plumbing.Reference // вроде ссылка на гит
refIter, err := repo.Branches() //получение веток
if err != nil {
logger.Fatalf(ctx, "failed to get branches: %v", err)
logger.Fatal(ctx, "failed to get branches: %v", err)
}
for {
ref, err := refIter.Next()
@ -353,10 +353,10 @@ func (g *Gitea) RequestClose(ctx context.Context, cfg *configcli.Config, branch
refIter.Close()
if headRef == nil {
logger.Fatalf(ctx, "failed to get repo branch head")
logger.Fatal(ctx, "failed to get repo branch head")
} // Не получили нужную ветку
logger.Infof(ctx, "repo head %s", headRef)
logger.Info(ctx, "repo head %s", headRef)
var pulls []*giteaPull
req, err := http.NewRequestWithContext(ctx, http.MethodGet, cfg.Source.APIURL+"/repos/"+cfg.Source.Repository+"/pulls?state=open&token="+cfg.Source.Token, nil)
@ -377,34 +377,34 @@ func (g *Gitea) RequestClose(ctx context.Context, cfg *configcli.Config, branch
}
if err = json.Unmarshal(buf, &pulls); err != nil {
logger.Fatalf(ctx, "failed to decode response %s err: %v", buf, err)
logger.Fatal(ctx, "failed to decode response %s err: %v", buf, err)
} // записываем ответ от гита по пулл реквестам, видимо существующим
// перебираем наши модификации и если они уже есть в гите удаляем их из mods
prExist := false
for _, pull := range pulls {
if strings.Contains(pull.Title, path) && pull.Base.Ref == branch {
logger.Infof(ctx, "skip %s since pr does not exist %s", path, pull.URL)
logger.Info(ctx, "skip %s since pr does not exist %s", path, pull.URL)
prExist = true
}
}
if !prExist {
logger.Errorf(ctx, " skip %s since pr does not exist", path)
logger.Error(ctx, " skip %s since pr does not exist", path)
return ErrPRNotExist
}
req, err = DeleteBranch(ctx, cfg, branch)
if err != nil {
logger.Errorf(ctx, "failed to create request for delete the branch: %s, err: %s", branch, err)
logger.Error(ctx, "failed to create request for delete the branch: %s, err: %s", branch, err)
return err
}
rsp, err = http.DefaultClient.Do(req)
if err != nil {
logger.Errorf(ctx, "failed to do request for delete the branch: %s, err: %s, code: %s", branch, err, rsp.StatusCode)
logger.Error(ctx, "failed to do request for delete the branch: %s, err: %s, code: %s", branch, err, rsp.StatusCode)
return err
}
logger.Infof(ctx, "Delete branch %s successful", branch)
logger.Info(ctx, "Delete branch %s successful", branch)
return nil
}
@ -426,34 +426,34 @@ func (g *Gitea) RequestUpdate(ctx context.Context, cfg *configcli.Config, branch
// создания шаблона названия для пулл реквеста
tplTitle, err := template.New("pull_request_title").Parse(cfg.PullRequestTitle)
if err != nil {
logger.Fatalf(ctx, "failed to parse template: %v", err)
logger.Fatal(ctx, "failed to parse template: %v", err)
}
wTitle := bytes.NewBuffer(nil)
// создания шаблона тела для пулл реквеста
tplBody, err := template.New("pull_request_body").Parse(cfg.PullRequestBody)
if err != nil {
logger.Fatalf(ctx, "failed to parse template: %v", err)
logger.Fatal(ctx, "failed to parse template: %v", err)
}
wBody := bytes.NewBuffer(nil)
// открытие гит репозитория с опцией обхода репозитория для нахождения .git
repo, err := git.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
if err != nil {
logger.Fatalf(ctx, "failed to open repo: %v", err)
logger.Fatal(ctx, "failed to open repo: %v", err)
}
//извлекаем ссылки с объектами из удаленного объекта??
if err = repo.FetchContext(ctx, &git.FetchOptions{
Auth: &httpauth.BasicAuth{Username: cfg.Source.Token, Password: cfg.Source.Token},
Force: true,
}); err != nil && err != git.NoErrAlreadyUpToDate {
logger.Fatalf(ctx, "failed to fetch repo: %v", err)
logger.Fatal(ctx, "failed to fetch repo: %v", err)
}
var headRef *plumbing.Reference // вроде ссылка на гит
refIter, err := repo.Branches() //получение веток
if err != nil {
logger.Fatalf(ctx, "failed to get branches: %v", err)
logger.Fatal(ctx, "failed to get branches: %v", err)
}
for {
ref, err := refIter.Next()
@ -468,14 +468,14 @@ func (g *Gitea) RequestUpdate(ctx context.Context, cfg *configcli.Config, branch
refIter.Close()
if headRef == nil {
logger.Fatalf(ctx, "failed to get repo branch head")
logger.Fatal(ctx, "failed to get repo branch head")
} // Не получили нужную ветку
logger.Infof(ctx, "repo head %s", headRef)
logger.Info(ctx, "repo head %s", headRef)
wtree, err := repo.Worktree()
if err != nil {
logger.Fatalf(ctx, "failed to get worktree: %v", err)
logger.Fatal(ctx, "failed to get worktree: %v", err)
}
var pulls []*giteaPull
@ -497,24 +497,24 @@ func (g *Gitea) RequestUpdate(ctx context.Context, cfg *configcli.Config, branch
}
if err = json.Unmarshal(buf, &pulls); err != nil {
logger.Fatalf(ctx, "failed to decode response %s err: %v", buf, err)
logger.Fatal(ctx, "failed to decode response %s err: %v", buf, err)
} // записываем ответ от гита по пулл реквестам, видимо существующим
// перебираем наши модификации и если они уже есть в гите удаляем их из mods
prExist := false
for _, pull := range pulls {
if strings.Contains(pull.Title, path) && pull.Base.Ref != branch {
logger.Infof(ctx, "skip %s since pr does not exist %s", path, pull.URL) //todo
logger.Info(ctx, "skip %s since pr does not exist %s", path, pull.URL) //todo
titleVersions := getVersions(pull.Title)
if modules.IsNewerVersion(titleVersions.NewV, mod.Version, false) {
reqDel, err := DeleteBranch(ctx, cfg, branch)
if err != nil {
logger.Errorf(ctx, "Error with create request for branch: %s, err: %s", branch, err)
logger.Error(ctx, "Error with create request for branch: %s, err: %s", branch, err)
continue
}
rsp, err := http.DefaultClient.Do(reqDel)
if err != nil {
logger.Errorf(ctx, "Error with do request for branch: %s, err: %s, code: %v", branch, err, rsp.StatusCode)
logger.Error(ctx, "Error with do request for branch: %s, err: %s, code: %v", branch, err, rsp.StatusCode)
continue //думаю что если не можем удалить ветку не стоит заканчивать работу, а перейти к следующей итерации
}
}
@ -522,15 +522,15 @@ func (g *Gitea) RequestUpdate(ctx context.Context, cfg *configcli.Config, branch
}
}
if !prExist {
logger.Errorf(ctx, " skip %s since pr does not exist", path)
logger.Error(ctx, " skip %s since pr does not exist", path)
return ErrPRNotExist
}
logger.Infof(ctx, "update %s from %s to %s", path, mod.Module.Version, mod.Version)
logger.Info(ctx, "update %s from %s to %s", path, mod.Module.Version, mod.Version)
logger.Infof(ctx, "reset worktree")
logger.Info(ctx, "reset worktree")
if err = wtree.Reset(&git.ResetOptions{Mode: git.HardReset}); err != nil {
logger.Fatalf(ctx, "failed to reset repo branch: %v", err)
logger.Fatal(ctx, "failed to reset repo branch: %v", err)
} //вроде меняем ветку
if err = wtree.PullContext(ctx, &git.PullOptions{
@ -540,17 +540,17 @@ func (g *Gitea) RequestUpdate(ctx context.Context, cfg *configcli.Config, branch
Force: true,
RemoteName: "origin",
}); err != nil && err != git.NoErrAlreadyUpToDate {
logger.Fatalf(ctx, "failed to pull repo: %v", err)
logger.Fatal(ctx, "failed to pull repo: %v", err)
}
logger.Infof(ctx, "checkout ref %s", headRef)
logger.Info(ctx, "checkout ref %s", headRef)
if err = wtree.Checkout(&git.CheckoutOptions{
Hash: headRef.Hash(),
Branch: headRef.Name(),
Create: false,
Force: true,
}); err != nil {
logger.Fatalf(ctx, "failed to checkout tree: %v", err)
logger.Fatal(ctx, "failed to checkout tree: %v", err)
} //вроде как переходим на другую ветку
epath, err := exec.LookPath("go")
@ -558,7 +558,7 @@ func (g *Gitea) RequestUpdate(ctx context.Context, cfg *configcli.Config, branch
err = nil
}
if err != nil {
logger.Fatalf(ctx, "failed to find go command: %v", err)
logger.Fatal(ctx, "failed to find go command: %v", err)
} // ищем go файл
var cmd *exec.Cmd
@ -566,25 +566,25 @@ func (g *Gitea) RequestUpdate(ctx context.Context, cfg *configcli.Config, branch
cmd = exec.CommandContext(ctx, epath, "mod", "edit", fmt.Sprintf("-require=%s@%s", path, mod.Version))
if out, err = cmd.CombinedOutput(); err != nil {
logger.Fatalf(ctx, "failed to run go mod edit: %s err: %v", out, err)
logger.Fatal(ctx, "failed to run go mod edit: %s err: %v", out, err)
} // пытаемся выполнить команду go mod edit с новой версией модуля
cmd = exec.CommandContext(ctx, epath, "mod", "tidy")
if out, err = cmd.CombinedOutput(); err != nil {
logger.Fatalf(ctx, "failed to run go mod tidy: %s err: %v", out, err)
logger.Fatal(ctx, "failed to run go mod tidy: %s err: %v", out, err)
} // пытаемся выполнить команду go mod tidy пытаемся подтянуть новую версию модуля
logger.Infof(ctx, "worktree add go.mod")
logger.Info(ctx, "worktree add go.mod")
if _, err = wtree.Add("go.mod"); err != nil {
logger.Fatalf(ctx, "failed to add file: %v", err)
logger.Fatal(ctx, "failed to add file: %v", err)
}
logger.Infof(ctx, "worktree add go.sum")
logger.Info(ctx, "worktree add go.sum")
if _, err = wtree.Add("go.sum"); err != nil {
logger.Fatalf(ctx, "failed to add file: %v", err)
logger.Fatal(ctx, "failed to add file: %v", err)
}
logger.Infof(ctx, "worktree commit")
logger.Info(ctx, "worktree commit")
_, err = wtree.Commit(wTitle.String(), &git.CommitOptions{
Parents: []plumbing.Hash{headRef.Hash()},
Author: &object.Signature{
@ -594,27 +594,27 @@ func (g *Gitea) RequestUpdate(ctx context.Context, cfg *configcli.Config, branch
},
}) // хотим за коммитить изменения
if err != nil {
logger.Fatalf(ctx, "failed to commit: %v", err)
logger.Fatal(ctx, "failed to commit: %v", err)
}
// newref := plumbing.NewHashReference(plumbing.ReferenceName(fmt.Sprintf("refs/heads/pkgdash-1/go_modules/%s-%s", path, mod.Version)), headRef.Hash())
/*
if err = repo.Storer.SetReference(newref); err != nil {
logger.Fatalf(ctx, "failed to create repo branch: %v", err)
logger.Fatal(ctx, "failed to create repo branch: %v", err)
}
*/
refspec := gitconfig.RefSpec(fmt.Sprintf("+refs/heads/pkgdash-1/go_modules/%s-%s:refs/heads/pkgdash-1/go_modules/%s-%s", path, mod.Version, path, mod.Version))
logger.Infof(ctx, "try to push refspec %s", refspec)
logger.Info(ctx, "try to push refspec %s", refspec)
if err = repo.PushContext(ctx, &git.PushOptions{
RefSpecs: []gitconfig.RefSpec{refspec},
Auth: &httpauth.BasicAuth{Username: cfg.Source.Token, Password: cfg.Source.Token},
Force: true,
}); err != nil {
logger.Fatalf(ctx, "failed to push repo branch: %v", err)
logger.Fatal(ctx, "failed to push repo branch: %v", err)
} // пытаемся за пушить изменения
data := map[string]string{
@ -624,10 +624,10 @@ func (g *Gitea) RequestUpdate(ctx context.Context, cfg *configcli.Config, branch
}
if err = tplTitle.Execute(wTitle, data); err != nil {
logger.Fatalf(ctx, "failed to execute template: %v", err)
logger.Fatal(ctx, "failed to execute template: %v", err)
}
if err = tplBody.Execute(wBody, data); err != nil {
logger.Fatalf(ctx, "failed to execute template: %v", err)
logger.Fatal(ctx, "failed to execute template: %v", err)
}
body := map[string]string{
@ -636,14 +636,14 @@ func (g *Gitea) RequestUpdate(ctx context.Context, cfg *configcli.Config, branch
"head": fmt.Sprintf("pkgdash-1/go_modules/%s-%s", path, mod.Version),
"title": wTitle.String(),
}
logger.Infof(ctx, "raw body: %#+v", body)
logger.Info(ctx, "raw body: %#+v", body)
buf, err = json.Marshal(body)
if err != nil {
return err
}
logger.Infof(ctx, "marshal body: %s", buf)
logger.Info(ctx, "marshal body: %s", buf)
req, err = http.NewRequestWithContext(ctx, http.MethodPost, cfg.Source.APIURL+"/repos/"+cfg.Source.Repository+"/pulls?token="+cfg.Source.Token, bytes.NewReader(buf))
if err != nil {

View File

@ -129,7 +129,7 @@ func (s *Postgres) CommentsCreate(ctx context.Context, req *pb.CommentsCreateReq
defer func() {
if err != nil {
if rollbackErr := tx.Rollback(); rollbackErr != nil {
logger.Errorf(ctx, "AddComment: unable to rollback: %v", rollbackErr)
logger.Error(ctx, "AddComment: unable to rollback: %v", rollbackErr)
}
} else {
err = tx.Commit()
@ -159,7 +159,7 @@ func (s *Postgres) PackagesCreate(ctx context.Context, req *pb.PackagesCreateReq
defer func() {
if err != nil {
if rollbackErr := tx.Rollback(); rollbackErr != nil {
logger.Errorf(ctx, "AddPackage: unable to rollback: %v", rollbackErr)
logger.Error(ctx, "AddPackage: unable to rollback: %v", rollbackErr)
}
} else {
err = tx.Commit()
@ -188,7 +188,7 @@ func (s *Postgres) InsertButchModules(ctx context.Context, req []models.Module)
defer func() {
if err != nil {
if rollbackErr := tx.Rollback(); rollbackErr != nil {
logger.Errorf(ctx, "AddPackage: unable to rollback: %v", rollbackErr)
logger.Error(ctx, "AddPackage: unable to rollback: %v", rollbackErr)
}
} else {
err = tx.Commit()

View File

@ -64,11 +64,11 @@ func (s *Sqlite) PackageModulesCreate(ctx context.Context, pkg *models.Package,
}
func (s *Sqlite) PackageDelete(ctx context.Context, req *pb.PackageDeleteReq) error {
return fmt.Errorf("need implement")
return fmt.Error("need implement")
}
func (s *Sqlite) PackageUpdate(ctx context.Context, req *pb.PackageUpdateReq) (*models.Package, error) {
return nil, fmt.Errorf("need implement")
return nil, fmt.Error("need implement")
}
func (s *Sqlite) PackageLookup(ctx context.Context, req *pb.PackageLookupReq) (*models.Package, error) {
@ -126,7 +126,7 @@ func (s *Sqlite) CommentCreate(ctx context.Context, req *pb.CommentCreateReq) (*
defer func() {
if err != nil {
if rollbackErr := tx.Rollback(); rollbackErr != nil {
logger.Errorf(ctx, "AddComment: unable to rollback: %v", rollbackErr)
logger.Error(ctx, "AddComment: unable to rollback: %v", rollbackErr)
}
} else {
err = tx.Commit()

View File

@ -42,13 +42,13 @@ func Run(ctx context.Context, store storage.Storage, td time.Duration) {
if err != sql.ErrNoRows {
continue
}
logger.Fatalf(ctx, "failed to get packages to process: %v", err)
logger.Fatal(ctx, "failed to get packages to process: %v", err)
}
wg.Add(len(packages))
for _, pkg := range packages {
go func(p *models.Package) {
if err := parseModFile(ctx, store, p); err != nil {
logger.Errorf(ctx, "failed to process package %s: %v", p.Name, err)
logger.Error(ctx, "failed to process package %s: %v", p.Name, err)
}
p.LastCheck.Time = time.Now()
wg.Done()
@ -56,7 +56,7 @@ func Run(ctx context.Context, store storage.Storage, td time.Duration) {
}
wg.Wait()
if err = store.PackagesUpdateLastCheck(ctx, packages); err != nil {
logger.Errorf(ctx, "update packages last_check %#+v, err: %v", packages, err)
logger.Error(ctx, "update packages last_check %#+v, err: %v", packages, err)
}
case <-modTicker.C:
modules, err := store.ModulesProcess(ctx, td)
@ -64,17 +64,17 @@ func Run(ctx context.Context, store storage.Storage, td time.Duration) {
if err != sql.ErrNoRows {
continue
}
logger.Fatalf(ctx, "failed to get modules to process: %v", err)
logger.Fatal(ctx, "failed to get modules to process: %v", err)
}
if err := processModules(ctx, store, modules); err != nil {
logger.Errorf(ctx, "failed to process modules: %v", err)
logger.Error(ctx, "failed to process modules: %v", err)
}
}
}
}
func parseModFile(ctx context.Context, store storage.Storage, pkg *models.Package) error {
logger.Infof(ctx, "process package %v", pkg)
logger.Info(ctx, "process package %v", pkg)
u, err := url.Parse(pkg.URL)
if err != nil {
@ -107,12 +107,12 @@ func parseModFile(ctx context.Context, store storage.Storage, pkg *models.Packag
ref, err := repo.Head()
if err != nil {
return fmt.Errorf("failed to get head: %v", err)
return fmt.Error("failed to get head: %v", err)
}
commit, err := repo.CommitObject(ref.Hash())
if err != nil {
return fmt.Errorf("failed to get commit: %v", err)
return fmt.Error("failed to get commit: %v", err)
}
tree, err := commit.Tree()
@ -156,7 +156,7 @@ func parseModFile(ctx context.Context, store storage.Storage, pkg *models.Packag
})
if err = store.PackageModulesCreate(ctx, pkg, modules); err != nil {
logger.Errorf(ctx, "failed to set create modules: %v", err)
logger.Error(ctx, "failed to set create modules: %v", err)
return err
}
@ -182,7 +182,7 @@ func processModules(ctx context.Context, store storage.Storage, mods []*models.M
Modules: mvsu,
OnUpdate: func(u modules.Update) {
if u.Err != nil {
logger.Errorf(ctx, "%s: failed: %v", u.Module.Path, u.Err)
logger.Error(ctx, "%s: failed: %v", u.Module.Path, u.Err)
} else {
mvs[u.Module.Path].Version = u.Version
}