From 4ec046e415755c87065056f8bc1ea08e8c92354b Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 4 Jun 2024 08:30:54 +0200 Subject: [PATCH] Spellcheck "server/*" (#3753) Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com> Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com> --- .cspell.json | 104 ++++++++++-------- Makefile | 2 +- cmd/agent/core/health.go | 4 +- cmd/server/docs/docs.go | 4 +- cmd/server/flags.go | 12 +- cmd/server/server.go | 8 +- cmd/server/setup.go | 16 +-- server/api/login.go | 40 +++---- server/api/metrics/prometheus.go | 4 +- server/api/org.go | 4 +- server/api/pipeline.go | 4 +- server/api/repo.go | 2 +- server/api/stream.go | 16 +-- server/badges/badges.go | 2 + server/forge/addon/logger.go | 8 +- server/forge/bitbucket/bitbucket.go | 16 +-- server/forge/bitbucket/convert.go | 14 +-- server/forge/bitbucket/internal/client.go | 4 +- server/forge/bitbucket/internal/types.go | 6 +- .../bitbucketdatacenter.go | 10 +- .../bitbucketdatacenter/internal/client.go | 2 +- server/forge/forgejo/helper.go | 24 ++-- server/forge/gitea/helper.go | 24 ++-- server/forge/github/github.go | 12 +- server/forge/github/parse.go | 2 +- server/grpc/server.go | 6 +- server/pipeline/items.go | 6 +- server/pipeline/restart.go | 6 +- server/services/config/http.go | 4 +- server/services/encryption/aes.go | 8 +- server/services/encryption/constants.go | 4 +- server/services/encryption/tink_keyset.go | 4 +- server/services/registry/filesystem.go | 10 +- woodpecker-go/woodpecker/client.go | 24 ++-- 34 files changed, 220 insertions(+), 196 deletions(-) diff --git a/.cspell.json b/.cspell.json index 3a2975842..cf4471397 100644 --- a/.cspell.json +++ b/.cspell.json @@ -12,123 +12,133 @@ ], "words": [ "abool", - "BUILDPLATFORM", - "Codeberg", - "Curr", - "DATASOURCE", - "Debugf", - "Fediverse", - "Fogas", - "GOARCH", - "GOBIN", - "GODEBUG", - "GOPATH", - "Georgiana", - "HEALTHCHECK", - "HTTPFS", - "Hetzner", - "Infof", - "Ionescu", - "Kaniko", - "Keyfunc", - "LASTEXITCODE", - "Laszlo", - "Msgf", - "Netrc", - "PROTOC", - "Pinia", - "Println", - "pwsh", - "Refspec", - "Reviewdog", - "Rydzewski", - "SSHURL", - "TARGETARCH", - "TARGETOS", - "Typeflag", - "Upsert", - "WORKDIR", - "Warnf", - "Weblate", - "Wrapf", "anbraten", "apimachinery", "autoincr", "autoscaler", "binutils", "bitbucketdatacenter", + "Boguslawski", "bradrydzewski", + "BUILDPLATFORM", "buildx", "ccmenu", + "certmagic", "charmbracelet", "ciphertext", + "Codeberg", "compatiblelicenses", "corepack", "cpuset", "creativecommons", + "Curr", "datacenter", + "DATASOURCE", + "Debugf", "desaturate", "devx", "doublestar", "envsubst", - "estree", "errgroup", + "estree", "evenodd", "excalidraw", "favicons", + "Fediverse", + "Fogas", "forbidigo", "Forgejo", "fsnotify", + "Georgiana", "gitea", + "GOARCH", + "GOBIN", "gocritic", + "GODEBUG", "golangci", "gomod", "gonic", + "GOPATH", + "HEALTHCHECK", + "healthz", + "Hetzner", + "HTMLURL", + "HTTPFS", "httpsig", + "HTTPURL", "httputil", "iconify", + "Infof", + "Informatyka", "intlify", + "Ionescu", + "Kaniko", + "Keyfunc", "kyvg", + "LASTEXITCODE", + "Laszlo", "laszlocph", "logfile", "loglevel", + "LONGBLOB", + "LONGTEXT", "mapstructure", "markdownlint", "memswap", + "Metas", + "mhmxs", "moby", + "Msgf", "multiarch", "multierr", "netdns", + "Netrc", "nfpm", "nixos", "nocolor", "nolint", + "norunningpipelines", + "nosniff", "octocat", + "Pinia", + "pkce", "posix", "ppid", + "Println", "prismjs", "proto", "protobuf", "protoc", + "PROTOC", "protoimpl", "protoreflect", - "rawurl", + "pullrequest", + "pullrequests", + "pwsh", + "Redirections", + "Refspec", "regcred", "repology", "reslimit", + "Reviewdog", "riscv", "rundll32", + "Rydzewski", "seccomp", "secprofile", "securecookie", "sess", "shellescape", + "SSHURL", "stepbuilder", "stretchr", "sublicensable", "swaggo", + "TARGETARCH", + "TARGETOS", "techknowlogick", "testdata", + "threadcreate", "tink", "tinycolor", "tmpfs", @@ -136,18 +146,27 @@ "tolerations", "ttlcache", "typecheck", + "Typeflag", "unplugin", + "Upsert", "urfave", "varchar", + "varz", "vueuse", "waivable", + "Warnf", + "Weblate", "windi", "windicss", "woodpeckerci", + "WORKDIR", + "Wrapf", + "xlink", "xlog", "xorm", "xormigrate", "xyaml", + "yamls", "zerolog", "zerologger" ], @@ -175,8 +194,7 @@ "**/fixtures/**", "**/testdata/**", // TODO: remove the following - "docs/", - "server/" + "docs/" ], // Exclude imports, because they are also strings. "ignoreRegExpList": [ diff --git a/Makefile b/Makefile index 1ccff3ab5..d5b092abc 100644 --- a/Makefile +++ b/Makefile @@ -173,7 +173,7 @@ test-server-datastore: ## Test server datastore go test -race -timeout 30s -skip TestMigrate go.woodpecker-ci.org/woodpecker/v2/server/store/... test-server-datastore-coverage: ## Test server datastore with coverage report - go test -race -cover -coverprofile datastore-coverage.out -timeout 120s go.woodpecker-ci.org/woodpecker/v2/server/store/... + go test -race -cover -coverprofile datastore-coverage.out -timeout 180s go.woodpecker-ci.org/woodpecker/v2/server/store/... test-ui: ui-dependencies ## Test UI code (cd web/; pnpm run lint) diff --git a/cmd/agent/core/health.go b/cmd/agent/core/health.go index 73328ec4e..263bd3269 100644 --- a/cmd/agent/core/health.go +++ b/cmd/agent/core/health.go @@ -32,8 +32,8 @@ import ( // https://github.com/mozilla-services/Dockerflow func initHealth() { - http.HandleFunc("/varz", handleStats) // cspell:words varz - http.HandleFunc("/healthz", handleHeartbeat) // cspell:words healthz + http.HandleFunc("/varz", handleStats) + http.HandleFunc("/healthz", handleHeartbeat) http.HandleFunc("/version", handleVersion) } diff --git a/cmd/server/docs/docs.go b/cmd/server/docs/docs.go index 58c3990c3..6d5cbed58 100644 --- a/cmd/server/docs/docs.go +++ b/cmd/server/docs/docs.go @@ -874,7 +874,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "the organziation's id", + "description": "the organization's id", "name": "org_id", "in": "path", "required": true @@ -913,7 +913,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "the organziation's id", + "description": "the organization's id", "name": "org_id", "in": "path", "required": true diff --git a/cmd/server/flags.go b/cmd/server/flags.go index 9ccdc0b1e..7b155fe05 100644 --- a/cmd/server/flags.go +++ b/cmd/server/flags.go @@ -38,7 +38,7 @@ var flags = append([]cli.Flag{ &cli.StringFlag{ EnvVars: []string{"WOODPECKER_HOST"}, Name: "server-host", - Usage: "server fully qualified url. Format: ://[/]", + Usage: "server fully qualified url. Format: ://[/]", }, &cli.StringFlag{ EnvVars: []string{"WOODPECKER_SERVER_ADDR"}, @@ -114,7 +114,7 @@ var flags = append([]cli.Flag{ &cli.StringSliceFlag{ EnvVars: []string{"WOODPECKER_REPO_OWNERS"}, Name: "repo-owners", - Usage: "List of syncable repo owners", + Usage: "Repositories by those owners will be allowed to be used in woodpecker", }, &cli.BoolFlag{ EnvVars: []string{"WOODPECKER_OPEN"}, @@ -277,7 +277,7 @@ var flags = append([]cli.Flag{ &cli.Int64Flag{ EnvVars: []string{"WOODPECKER_LIMIT_MEM_SWAP"}, Name: "limit-mem-swap", - Usage: "maximum swappable memory allowed in bytes", + Usage: "maximum memory used for swap in bytes", }, &cli.Int64Flag{ EnvVars: []string{"WOODPECKER_LIMIT_MEM"}, @@ -330,7 +330,7 @@ var flags = append([]cli.Flag{ &cli.StringFlag{ EnvVars: []string{"WOODPECKER_EXPERT_FORGE_OAUTH_HOST", "WOODPECKER_DEV_GITEA_OAUTH_URL"}, // TODO: remove WOODPECKER_DEV_GITEA_OAUTH_URL in next major release Name: "forge-oauth-host", - Usage: "!!!for experts!!! fully qualified public forge url. Use it if your forge url WOODPECKER_FORGE_URL or WOODPECKER_GITEA_URL, ... isn't a public url. Format: ://[/]", + Usage: "!!!for experts!!! fully qualified public forge url. Use it if your forge url WOODPECKER_FORGE_URL or WOODPECKER_GITEA_URL, ... isn't a public url. Format: ://[/]", }, // // Addon @@ -427,13 +427,13 @@ var flags = append([]cli.Flag{ &cli.StringFlag{ EnvVars: []string{"WOODPECKER_EXPERT_WEBHOOK_HOST", "WOODPECKER_WEBHOOK_HOST"}, // TODO: remove WOODPECKER_WEBHOOK_HOST in next major release Name: "server-webhook-host", - Usage: "!!!for experts!!! fully qualified woodpecker server url called by forge's webhooks. Format: ://[/]", + Usage: "!!!for experts!!! fully qualified woodpecker server url called by forge's webhooks. Format: ://[/]", }, // TODO: remove in next major release &cli.StringFlag{ EnvVars: []string{"WOODPECKER_DEV_OAUTH_HOST"}, Name: "server-dev-oauth-host-deprecated", - Usage: "DEPRECATED: use WOODPECKER_EXPERT_FORGE_OAUTH_HOST instead\nfully qualified url used for oauth redirects. Format: ://[/]", + Usage: "DEPRECATED: use WOODPECKER_EXPERT_FORGE_OAUTH_HOST instead\nfully qualified url used for oauth redirects. Format: ://[/]", Value: "", Hidden: true, }, diff --git a/cmd/server/server.go b/cmd/server/server.go index bc5a8b2c6..e46d511b8 100644 --- a/cmd/server/server.go +++ b/cmd/server/server.go @@ -27,7 +27,7 @@ import ( "github.com/caddyserver/certmagic" "github.com/gin-gonic/gin" - "github.com/prometheus/client_golang/prometheus/promhttp" + prometheus_http "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/urfave/cli/v2" @@ -250,7 +250,7 @@ func run(c *cli.Context) error { if metricsServerAddr := c.String("metrics-server-addr"); metricsServerAddr != "" { g.Go(func() error { metricsRouter := gin.New() - metricsRouter.GET("/metrics", gin.WrapH(promhttp.Handler())) + metricsRouter.GET("/metrics", gin.WrapH(prometheus_http.Handler())) err := http.ListenAndServe(metricsServerAddr, metricsRouter) if err != nil && !errors.Is(err, http.ErrServerClosed) { log.Fatal().Err(err).Msg("could not start metrics server") //nolint:forbidigo @@ -270,11 +270,11 @@ func setupEvilGlobals(c *cli.Context, s store.Store) error { server.Config.Services.Logs = logging.New() server.Config.Services.Pubsub = pubsub.New() server.Config.Services.Membership = setupMembershipService(c, s) - serviceMangager, err := services.NewManager(c, s, setup.Forge) + serviceManager, err := services.NewManager(c, s, setup.Forge) if err != nil { return fmt.Errorf("could not setup service manager: %w", err) } - server.Config.Services.Manager = serviceMangager + server.Config.Services.Manager = serviceManager // authentication server.Config.Pipeline.AuthenticatePublicRepos = c.Bool("authenticate-public-repos") diff --git a/cmd/server/setup.go b/cmd/server/setup.go index 8df86cc86..a7f990fa1 100644 --- a/cmd/server/setup.go +++ b/cmd/server/setup.go @@ -22,7 +22,7 @@ import ( "time" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" + prometheus_auto "github.com/prometheus/client_golang/prometheus/promauto" "github.com/rs/zerolog/log" "github.com/urfave/cli/v2" "golang.org/x/sync/errgroup" @@ -96,37 +96,37 @@ func setupMembershipService(_ *cli.Context, _store store.Store) cache.Membership } func setupMetrics(g *errgroup.Group, _store store.Store) { - pendingSteps := promauto.NewGauge(prometheus.GaugeOpts{ + pendingSteps := prometheus_auto.NewGauge(prometheus.GaugeOpts{ Namespace: "woodpecker", Name: "pending_steps", Help: "Total number of pending pipeline steps.", }) - waitingSteps := promauto.NewGauge(prometheus.GaugeOpts{ + waitingSteps := prometheus_auto.NewGauge(prometheus.GaugeOpts{ Namespace: "woodpecker", Name: "waiting_steps", Help: "Total number of pipeline waiting on deps.", }) - runningSteps := promauto.NewGauge(prometheus.GaugeOpts{ + runningSteps := prometheus_auto.NewGauge(prometheus.GaugeOpts{ Namespace: "woodpecker", Name: "running_steps", Help: "Total number of running pipeline steps.", }) - workers := promauto.NewGauge(prometheus.GaugeOpts{ + workers := prometheus_auto.NewGauge(prometheus.GaugeOpts{ Namespace: "woodpecker", Name: "worker_count", Help: "Total number of workers.", }) - pipelines := promauto.NewGauge(prometheus.GaugeOpts{ + pipelines := prometheus_auto.NewGauge(prometheus.GaugeOpts{ Namespace: "woodpecker", Name: "pipeline_total_count", Help: "Total number of pipelines.", }) - users := promauto.NewGauge(prometheus.GaugeOpts{ + users := prometheus_auto.NewGauge(prometheus.GaugeOpts{ Namespace: "woodpecker", Name: "user_count", Help: "Total number of users.", }) - repos := promauto.NewGauge(prometheus.GaugeOpts{ + repos := prometheus_auto.NewGauge(prometheus.GaugeOpts{ Namespace: "woodpecker", Name: "repo_count", Help: "Total number of repos.", diff --git a/server/api/login.go b/server/api/login.go index bdd21dd73..c03de5db2 100644 --- a/server/api/login.go +++ b/server/api/login.go @@ -55,7 +55,7 @@ func HandleAuth(c *gin.Context) { // cannot, however, remember why, so need to revisit this line. c.Writer.Header().Del("Content-Type") - tmpuser, redirectURL, err := _forge.Login(c, &forge_types.OAuthRequest{ + tmpUser, redirectURL, err := _forge.Login(c, &forge_types.OAuthRequest{ Error: c.Request.FormValue("error"), ErrorURI: c.Request.FormValue("error_uri"), ErrorDescription: c.Request.FormValue("error_description"), @@ -67,13 +67,13 @@ func HandleAuth(c *gin.Context) { return } // The user is not authorized yet -> redirect - if tmpuser == nil { + if tmpUser == nil { http.Redirect(c.Writer, c.Request, redirectURL, http.StatusSeeOther) return } // get the user from the database - u, err := _store.GetUserRemoteID(tmpuser.ForgeRemoteID, tmpuser.Login) + u, err := _store.GetUserRemoteID(tmpUser.ForgeRemoteID, tmpUser.Login) if err != nil && !errors.Is(err, types.RecordNotExist) { _ = c.AbortWithError(http.StatusInternalServerError, err) return @@ -81,8 +81,8 @@ func HandleAuth(c *gin.Context) { if errors.Is(err, types.RecordNotExist) { // if self-registration is disabled we should return a not authorized error - if !server.Config.Permissions.Open && !server.Config.Permissions.Admins.IsAdmin(tmpuser) { - log.Error().Msgf("cannot register %s. registration closed", tmpuser.Login) + if !server.Config.Permissions.Open && !server.Config.Permissions.Admins.IsAdmin(tmpUser) { + log.Error().Msgf("cannot register %s. registration closed", tmpUser.Login) c.Redirect(http.StatusSeeOther, server.Config.Server.RootPath+"/login?error=access_denied") return } @@ -90,7 +90,7 @@ func HandleAuth(c *gin.Context) { // if self-registration is enabled for allowed organizations we need to // check the user's organization membership. if server.Config.Permissions.Orgs.IsConfigured { - teams, terr := _forge.Teams(c, tmpuser) + teams, terr := _forge.Teams(c, tmpUser) if terr != nil || !server.Config.Permissions.Orgs.IsMember(teams) { log.Error().Err(terr).Msgf("cannot verify team membership for %s.", u.Login) c.Redirect(http.StatusSeeOther, server.Config.Server.RootPath+"/login?error=access_denied") @@ -100,12 +100,12 @@ func HandleAuth(c *gin.Context) { // create the user account u = &model.User{ - Login: tmpuser.Login, - ForgeRemoteID: tmpuser.ForgeRemoteID, - Token: tmpuser.Token, - Secret: tmpuser.Secret, - Email: tmpuser.Email, - Avatar: tmpuser.Avatar, + Login: tmpUser.Login, + ForgeRemoteID: tmpUser.ForgeRemoteID, + Token: tmpUser.Token, + Secret: tmpUser.Secret, + Email: tmpUser.Email, + Avatar: tmpUser.Avatar, ForgeID: forgeID, Hash: base32.StdEncoding.EncodeToString( securecookie.GenerateRandomKey(32), @@ -146,7 +146,7 @@ func HandleAuth(c *gin.Context) { } // update org name - if u.Login != tmpuser.Login { + if u.Login != tmpUser.Login { org, err := _store.OrgGet(u.OrgID) if err != nil { log.Error().Err(err).Msgf("cannot get org %s", u.Login) @@ -160,13 +160,13 @@ func HandleAuth(c *gin.Context) { } // update the user meta data and authorization data. - u.Token = tmpuser.Token - u.Secret = tmpuser.Secret - u.Email = tmpuser.Email - u.Avatar = tmpuser.Avatar - u.ForgeRemoteID = tmpuser.ForgeRemoteID - u.Login = tmpuser.Login - u.Admin = u.Admin || server.Config.Permissions.Admins.IsAdmin(tmpuser) + u.Token = tmpUser.Token + u.Secret = tmpUser.Secret + u.Email = tmpUser.Email + u.Avatar = tmpUser.Avatar + u.ForgeRemoteID = tmpUser.ForgeRemoteID + u.Login = tmpUser.Login + u.Admin = u.Admin || server.Config.Permissions.Admins.IsAdmin(tmpUser) // if self-registration is enabled for allowed organizations we need to // check the user's organization membership. diff --git a/server/api/metrics/prometheus.go b/server/api/metrics/prometheus.go index 594de1760..b8f65e67b 100644 --- a/server/api/metrics/prometheus.go +++ b/server/api/metrics/prometheus.go @@ -20,7 +20,7 @@ import ( "net/http" "github.com/gin-gonic/gin" - "github.com/prometheus/client_golang/prometheus/promhttp" + prometheus_http "github.com/prometheus/client_golang/prometheus/promhttp" "go.woodpecker-ci.org/woodpecker/v2/server" ) @@ -30,7 +30,7 @@ var errInvalidToken = errors.New("invalid or missing token") // PromHandler will pass the call from /api/metrics/prometheus to prometheus. func PromHandler() gin.HandlerFunc { - handler := promhttp.Handler() + handler := prometheus_http.Handler() return func(c *gin.Context) { token := server.Config.Prometheus.AuthToken diff --git a/server/api/org.go b/server/api/org.go index 828728c90..507185c5c 100644 --- a/server/api/org.go +++ b/server/api/org.go @@ -36,7 +36,7 @@ import ( // @Success 200 {array} Org // @Tags Organization // @Param Authorization header string true "Insert your personal access token" default(Bearer ) -// @Param org_id path string true "the organziation's id" +// @Param org_id path string true "the organization's id" func GetOrg(c *gin.Context) { _store := store.FromContext(c) @@ -63,7 +63,7 @@ func GetOrg(c *gin.Context) { // @Success 200 {array} OrgPerm // @Tags Organization permissions // @Param Authorization header string true "Insert your personal access token" default(Bearer ) -// @Param org_id path string true "the organziation's id" +// @Param org_id path string true "the organization's id" func GetOrgPermissions(c *gin.Context) { user := session.User(c) _store := store.FromContext(c) diff --git a/server/api/pipeline.go b/server/api/pipeline.go index ed077b088..0ff2b734e 100644 --- a/server/api/pipeline.go +++ b/server/api/pipeline.go @@ -580,11 +580,11 @@ func PostPipeline(c *gin.Context) { } } - newpipeline, err := pipeline.Restart(c, _store, pl, user, repo, envs) + newPipeline, err := pipeline.Restart(c, _store, pl, user, repo, envs) if err != nil { handlePipelineErr(c, err) } else { - c.JSON(http.StatusOK, newpipeline) + c.JSON(http.StatusOK, newPipeline) } } diff --git a/server/api/repo.go b/server/api/repo.go index faca0444b..eb76bf1a2 100644 --- a/server/api/repo.go +++ b/server/api/repo.go @@ -220,7 +220,7 @@ func PatchRepo(c *gin.Context) { } if in.Timeout != nil && *in.Timeout > server.Config.Pipeline.MaxTimeout && !user.Admin { - c.String(http.StatusForbidden, fmt.Sprintf("Timeout is not allowed to be higher than max timeout (%dmin)", server.Config.Pipeline.MaxTimeout)) + c.String(http.StatusForbidden, fmt.Sprintf("Timeout is not allowed to be higher than max timeout (%d min)", server.Config.Pipeline.MaxTimeout)) return } if in.IsTrusted != nil && *in.IsTrusted != repo.IsTrusted && !user.Admin { diff --git a/server/api/stream.go b/server/api/stream.go index 6189cfc3d..cd187681c 100644 --- a/server/api/stream.go +++ b/server/api/stream.go @@ -71,14 +71,14 @@ func EventStreamSSE(c *gin.Context) { } } - eventc := make(chan []byte, 10) + eventChan := make(chan []byte, 10) ctx, cancel := context.WithCancelCause( context.Background(), ) defer func() { cancel(nil) - close(eventc) + close(eventChan) log.Debug().Msg("user feed: connection closed") }() @@ -95,7 +95,7 @@ func EventStreamSSE(c *gin.Context) { case <-ctx.Done(): return default: - eventc <- m.Data + eventChan <- m.Data } } }) @@ -111,7 +111,7 @@ func EventStreamSSE(c *gin.Context) { case <-time.After(time.Second * 30): logWriteStringErr(io.WriteString(rw, ": ping\n\n")) flusher.Flush() - case buf, ok := <-eventc: + case buf, ok := <-eventChan: if ok { logWriteStringErr(io.WriteString(rw, "data: ")) logWriteStringErr(rw.Write(buf)) @@ -192,7 +192,7 @@ func LogStreamSSE(c *gin.Context) { return } - logc := make(chan []byte, 10) + logChan := make(chan []byte, 10) ctx, cancel := context.WithCancelCause( context.Background(), ) @@ -201,7 +201,7 @@ func LogStreamSSE(c *gin.Context) { defer func() { cancel(nil) - close(logc) + close(logChan) log.Debug().Msg("log stream: connection closed") }() @@ -213,7 +213,7 @@ func LogStreamSSE(c *gin.Context) { return default: ee, _ := json.Marshal(entry) - logc <- ee + logChan <- ee } } }) @@ -250,7 +250,7 @@ func LogStreamSSE(c *gin.Context) { case <-time.After(time.Second * 30): logWriteStringErr(io.WriteString(rw, ": ping\n\n")) flusher.Flush() - case buf, ok := <-logc: + case buf, ok := <-logChan: if ok { if id > last { logWriteStringErr(io.WriteString(rw, "id: "+strconv.Itoa(id))) diff --git a/server/badges/badges.go b/server/badges/badges.go index e06df2327..99d82bd90 100644 --- a/server/badges/badges.go +++ b/server/badges/badges.go @@ -16,6 +16,8 @@ package badges import "go.woodpecker-ci.org/woodpecker/v2/server/model" +// cspell:words Verdana + var ( badgeSuccess = `pipeline: successpipelinesuccess` badgeFailure = `pipeline: failurepipelinefailure` diff --git a/server/forge/addon/logger.go b/server/forge/addon/logger.go index 5d617b1c9..d4305bc08 100644 --- a/server/forge/addon/logger.go +++ b/server/forge/addon/logger.go @@ -17,7 +17,7 @@ package addon import ( "bytes" "io" - stdlog "log" + std_log "log" "github.com/hashicorp/go-hclog" "github.com/rs/zerolog" @@ -30,6 +30,8 @@ type clientLogger struct { withArgs []any } +// cspell:words hclog + func convertLvl(level hclog.Level) zerolog.Level { switch level { case hclog.Error: @@ -162,8 +164,8 @@ func (c *clientLogger) GetLevel() hclog.Level { return hclog.NoLevel } -func (c *clientLogger) StandardLogger(opts *hclog.StandardLoggerOptions) *stdlog.Logger { - return stdlog.New(c.StandardWriter(opts), "", 0) +func (c *clientLogger) StandardLogger(opts *hclog.StandardLoggerOptions) *std_log.Logger { + return std_log.New(c.StandardWriter(opts), "", 0) } func (c *clientLogger) StandardWriter(*hclog.StandardLoggerOptions) io.Writer { diff --git a/server/forge/bitbucket/bitbucket.go b/server/forge/bitbucket/bitbucket.go index 02e2f1c86..c87047788 100644 --- a/server/forge/bitbucket/bitbucket.go +++ b/server/forge/bitbucket/bitbucket.go @@ -204,13 +204,13 @@ func (c *config) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error return nil, err } - userPermisions, err := client.ListPermissionsAll() + userPermissions, err := client.ListPermissionsAll() if err != nil { return nil, err } userPermissionsByRepo := make(map[string]*internal.RepoPerm) - for _, permission := range userPermisions { + for _, permission := range userPermissions { userPermissionsByRepo[permission.Repo.FullName] = permission } @@ -313,7 +313,7 @@ func (c *config) Status(ctx context.Context, user *model.User, repo *model.Repo, // the Bitbucket repository. Prior to registering hook, previously created hooks // are deleted. func (c *config) Activate(ctx context.Context, u *model.User, r *model.Repo, link string) error { - rawurl, err := url.Parse(link) + rawURL, err := url.Parse(link) if err != nil { return err } @@ -321,7 +321,7 @@ func (c *config) Activate(ctx context.Context, u *model.User, r *model.Repo, lin return c.newClient(ctx, u).CreateHook(r.Owner, r.Name, &internal.Hook{ Active: true, - Desc: rawurl.Host, + Desc: rawURL.Host, Events: []string{"repo:push", "pullrequest:created"}, URL: link, }) @@ -468,14 +468,14 @@ func (c *config) newOAuth2Config() *oauth2.Config { } // helper function to return matching hooks. -func matchingHooks(hooks []*internal.Hook, rawurl string) *internal.Hook { - link, err := url.Parse(rawurl) +func matchingHooks(hooks []*internal.Hook, rawURL string) *internal.Hook { + link, err := url.Parse(rawURL) if err != nil { return nil } for _, hook := range hooks { - hookurl, err := url.Parse(hook.URL) - if err == nil && hookurl.Host == link.Host { + hookURL, err := url.Parse(hook.URL) + if err == nil && hookURL.Host == link.Host { return hook } } diff --git a/server/forge/bitbucket/convert.go b/server/forge/bitbucket/convert.go index e9faee70f..af573cbff 100644 --- a/server/forge/bitbucket/convert.go +++ b/server/forge/bitbucket/convert.go @@ -28,7 +28,7 @@ import ( ) const ( - statusPending = "INPROGRESS" + statusPending = "INPROGRESS" // cspell:disable-line statusSuccess = "SUCCESSFUL" statusFailure = "FAILED" ) @@ -60,7 +60,7 @@ func convertRepo(from *internal.Repo, perm *internal.RepoPerm) *model.Repo { IsSCMPrivate: from.IsPrivate, Avatar: from.Owner.Links.Avatar.Href, SCMKind: model.SCMKind(from.Scm), - Branch: from.Mainbranch.Name, + Branch: from.MainBranch.Name, Perm: convertPerm(perm), PREnabled: true, } @@ -107,10 +107,10 @@ func cloneLink(repo *internal.Repo) string { // if bitbucket tries to automatically populate the user in the url we must // strip it out. - cloneurl, err := url.Parse(clone) + cloneURL, err := url.Parse(clone) if err == nil { - cloneurl.User = nil - clone = cloneurl.String() + cloneURL.User = nil + clone = cloneURL.String() } return clone @@ -217,8 +217,8 @@ func convertPushHook(hook *internal.PushHook, change *internal.Change) *model.Pi var reGitMail = regexp.MustCompile("<(.*)>") // extracts the email from a git commit author string. -func extractEmail(gitauthor string) (author string) { - matches := reGitMail.FindAllStringSubmatch(gitauthor, -1) +func extractEmail(gitAuthor string) (author string) { + matches := reGitMail.FindAllStringSubmatch(gitAuthor, -1) if len(matches) == 1 { author = matches[0][1] } diff --git a/server/forge/bitbucket/internal/client.go b/server/forge/bitbucket/internal/client.go index 9bae76ae8..fcaacdd91 100644 --- a/server/forge/bitbucket/internal/client.go +++ b/server/forge/bitbucket/internal/client.go @@ -258,8 +258,8 @@ func (c *Client) GetRepoFiles(owner, name, revision, path string, page *string) return out, err } -func (c *Client) do(rawurl, method string, in, out any) (*string, error) { - uri, err := url.Parse(rawurl) +func (c *Client) do(rawURL, method string, in, out any) (*string, error) { + uri, err := url.Parse(rawURL) if err != nil { return nil, err } diff --git a/server/forge/bitbucket/internal/types.go b/server/forge/bitbucket/internal/types.go index e9d7ecc87..a5dc4acb4 100644 --- a/server/forge/bitbucket/internal/types.go +++ b/server/forge/bitbucket/internal/types.go @@ -20,6 +20,8 @@ import ( "time" ) +// cspell:words pagelen + type Account struct { UUID string `json:"uuid"` Login string `json:"username"` @@ -108,10 +110,10 @@ type Repo struct { Scm string `json:"scm"` Desc string `json:"desc"` Links Links `json:"links"` - Mainbranch struct { + MainBranch struct { Type string `json:"type"` Name string `json:"name"` - } `json:"mainbranch"` + } `json:"mainbranch"` // cspell:ignore mainbranch } type RepoResp struct { diff --git a/server/forge/bitbucketdatacenter/bitbucketdatacenter.go b/server/forge/bitbucketdatacenter/bitbucketdatacenter.go index c2dad10aa..573ee52e3 100644 --- a/server/forge/bitbucketdatacenter/bitbucketdatacenter.go +++ b/server/forge/bitbucketdatacenter/bitbucketdatacenter.go @@ -96,7 +96,7 @@ func (c *client) URL() string { func (c *client) Login(ctx context.Context, req *forge_types.OAuthRequest) (*model.User, string, error) { config := c.newOAuth2Config() - // TODO: Add proper state and pkce... + // TODO: Add proper state and pkce (https://oauth.net/2/pkce/) ... redirectURL := config.AuthCodeURL("woodpecker") if req.Error != "" { @@ -298,12 +298,12 @@ func (c *client) Dir(ctx context.Context, u *model.User, r *model.Repo, p *model return nil, err } for _, f := range list { - fullpath := fmt.Sprintf("%s/%s", path, f) - data, err := c.File(ctx, u, r, p, fullpath) + fullPath := fmt.Sprintf("%s/%s", path, f) + data, err := c.File(ctx, u, r, p, fullPath) if err != nil { return nil, err } - all = append(all, &forge_types.FileMeta{Name: fullpath, Data: data}) + all = append(all, &forge_types.FileMeta{Name: fullPath, Data: data}) } if resp.LastPage { break @@ -423,7 +423,7 @@ func (c *client) Activate(ctx context.Context, u *model.User, r *model.Repo, lin err = c.Deactivate(ctx, u, r, link) if err != nil { - return fmt.Errorf("unable to deactive old webhooks: %w", err) + return fmt.Errorf("unable to deactivate old webhooks: %w", err) } webhook := &bb.Webhook{ diff --git a/server/forge/bitbucketdatacenter/internal/client.go b/server/forge/bitbucketdatacenter/internal/client.go index f989f13bc..1291ccc7c 100644 --- a/server/forge/bitbucketdatacenter/internal/client.go +++ b/server/forge/bitbucketdatacenter/internal/client.go @@ -25,7 +25,7 @@ import ( ) const ( - currentUserID = "%s/plugins/servlet/applinks/whoami" + currentUserID = "%s/plugins/servlet/applinks/whoami" // cspell:disable-line ) type Client struct { diff --git a/server/forge/forgejo/helper.go b/server/forge/forgejo/helper.go index 0dc2eb19f..0ab2b24e0 100644 --- a/server/forge/forgejo/helper.go +++ b/server/forge/forgejo/helper.go @@ -231,36 +231,36 @@ func fixMalformedAvatar(url string) string { // expandAvatar is a helper function that converts a relative avatar URL to the // absolute url. -func expandAvatar(repo, rawurl string) string { - aurl, err := url.Parse(rawurl) +func expandAvatar(repo, rawURL string) string { + aURL, err := url.Parse(rawURL) if err != nil { - return rawurl + return rawURL } - if aurl.IsAbs() { + if aURL.IsAbs() { // Url is already absolute - return aurl.String() + return aURL.String() } // Resolve to base burl, err := url.Parse(repo) if err != nil { - return rawurl + return rawURL } - aurl = burl.ResolveReference(aurl) + aURL = burl.ResolveReference(aURL) - return aurl.String() + return aURL.String() } // helper function to return matching hooks. -func matchingHooks(hooks []*forgejo.Hook, rawurl string) *forgejo.Hook { - link, err := url.Parse(rawurl) +func matchingHooks(hooks []*forgejo.Hook, rawURL string) *forgejo.Hook { + link, err := url.Parse(rawURL) if err != nil { return nil } for _, hook := range hooks { if val, ok := hook.Config["url"]; ok { - hookurl, err := url.Parse(val) - if err == nil && hookurl.Host == link.Host { + hookURL, err := url.Parse(val) + if err == nil && hookURL.Host == link.Host { return hook } } diff --git a/server/forge/gitea/helper.go b/server/forge/gitea/helper.go index 6ac89bf34..69b2a885b 100644 --- a/server/forge/gitea/helper.go +++ b/server/forge/gitea/helper.go @@ -230,36 +230,36 @@ func fixMalformedAvatar(url string) string { } // expandAvatar converts a relative avatar URL to the absolute url. -func expandAvatar(repo, rawurl string) string { - aurl, err := url.Parse(rawurl) +func expandAvatar(repo, rawURL string) string { + aURL, err := url.Parse(rawURL) if err != nil { - return rawurl + return rawURL } - if aurl.IsAbs() { + if aURL.IsAbs() { // Url is already absolute - return aurl.String() + return aURL.String() } // Resolve to base burl, err := url.Parse(repo) if err != nil { - return rawurl + return rawURL } - aurl = burl.ResolveReference(aurl) + aURL = burl.ResolveReference(aURL) - return aurl.String() + return aURL.String() } // matchingHooks return matching hooks. -func matchingHooks(hooks []*gitea.Hook, rawurl string) *gitea.Hook { - link, err := url.Parse(rawurl) +func matchingHooks(hooks []*gitea.Hook, rawURL string) *gitea.Hook { + link, err := url.Parse(rawURL) if err != nil { return nil } for _, hook := range hooks { if val, ok := hook.Config["url"]; ok { - hookurl, err := url.Parse(val) - if err == nil && hookurl.Host == link.Host { + hookURL, err := url.Parse(val) + if err == nil && hookURL.Host == link.Host { return hook } } diff --git a/server/forge/github/github.go b/server/forge/github/github.go index b0239c6e2..0e62413cf 100644 --- a/server/forge/github/github.go +++ b/server/forge/github/github.go @@ -260,7 +260,7 @@ func (c *client) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model } fc := make(chan *forge_types.FileMeta) - errc := make(chan error) + errChan := make(chan error) for _, file := range data { go func(path string) { @@ -269,7 +269,7 @@ func (c *client) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model if errors.Is(err, &forge_types.ErrConfigNotFound{}) { err = fmt.Errorf("git tree reported existence of file but we got: %s", err.Error()) } - errc <- err + errChan <- err } else { fc <- &forge_types.FileMeta{ Name: path, @@ -283,7 +283,7 @@ func (c *client) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model for i := 0; i < len(data); i++ { select { - case err := <-errc: + case err := <-errChan: return nil, err case fileMeta := <-fc: files = append(files, fileMeta) @@ -291,7 +291,7 @@ func (c *client) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model } close(fc) - close(errc) + close(errChan) return files, nil } @@ -474,8 +474,8 @@ func matchingEmail(emails []*github.UserEmail, rawURL string) *github.UserEmail } // matchingHooks returns matching hook. -func matchingHooks(hooks []*github.Hook, rawurl string) *github.Hook { - link, err := url.Parse(rawurl) +func matchingHooks(hooks []*github.Hook, rawURL string) *github.Hook { + link, err := url.Parse(rawURL) if err != nil { return nil } diff --git a/server/forge/github/parse.go b/server/forge/github/parse.go index 6d3645ff8..5c1ed8dbe 100644 --- a/server/forge/github/parse.go +++ b/server/forge/github/parse.go @@ -197,7 +197,7 @@ func parseReleaseHook(hook *github.ReleaseEvent) (*model.Repo, *model.Pipeline) Event: model.EventRelease, ForgeURL: hook.GetRelease().GetHTMLURL(), Ref: fmt.Sprintf("refs/tags/%s", hook.GetRelease().GetTagName()), - Branch: hook.GetRelease().GetTargetCommitish(), + Branch: hook.GetRelease().GetTargetCommitish(), // cspell:disable-line Message: fmt.Sprintf("created release %s", name), Author: hook.GetRelease().GetAuthor().GetLogin(), Avatar: hook.GetRelease().GetAuthor().GetAvatarURL(), diff --git a/server/grpc/server.go b/server/grpc/server.go index 81b4dc8b1..67c942223 100644 --- a/server/grpc/server.go +++ b/server/grpc/server.go @@ -19,7 +19,7 @@ import ( "encoding/json" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" + prometheus_auto "github.com/prometheus/client_golang/prometheus/promauto" "go.woodpecker-ci.org/woodpecker/v2/pipeline/rpc" "go.woodpecker-ci.org/woodpecker/v2/pipeline/rpc/proto" @@ -37,12 +37,12 @@ type WoodpeckerServer struct { } func NewWoodpeckerServer(queue queue.Queue, logger logging.Log, pubsub *pubsub.Publisher, store store.Store) proto.WoodpeckerServer { - pipelineTime := promauto.NewGaugeVec(prometheus.GaugeOpts{ + pipelineTime := prometheus_auto.NewGaugeVec(prometheus.GaugeOpts{ Namespace: "woodpecker", Name: "pipeline_time", Help: "Pipeline time.", }, []string{"repo", "branch", "status", "pipeline"}) - pipelineCount := promauto.NewCounterVec(prometheus.CounterOpts{ + pipelineCount := prometheus_auto.NewCounterVec(prometheus.CounterOpts{ Namespace: "woodpecker", Name: "pipeline_count", Help: "Pipeline count.", diff --git a/server/pipeline/items.go b/server/pipeline/items.go index 47cc49a13..92f59af7e 100644 --- a/server/pipeline/items.go +++ b/server/pipeline/items.go @@ -97,9 +97,9 @@ func createPipelineItems(c context.Context, forge forge.Forge, store store.Store ) (*model.Pipeline, []*stepbuilder.Item, error) { pipelineItems, err := parsePipeline(forge, store, currentPipeline, user, repo, yamls, envs) if pipeline_errors.HasBlockingErrors(err) { - currentPipeline, uerr := UpdateToStatusError(store, *currentPipeline, err) - if uerr != nil { - log.Error().Err(uerr).Msgf("error setting error status of pipeline for %s#%d", repo.FullName, currentPipeline.Number) + currentPipeline, uErr := UpdateToStatusError(store, *currentPipeline, err) + if uErr != nil { + log.Error().Err(uErr).Msgf("error setting error status of pipeline for %s#%d", repo.FullName, currentPipeline.Number) } else { updatePipelineStatus(c, forge, currentPipeline, repo, user) } diff --git a/server/pipeline/restart.go b/server/pipeline/restart.go index 21887cde5..e8b841bf1 100644 --- a/server/pipeline/restart.go +++ b/server/pipeline/restart.go @@ -74,9 +74,9 @@ func Restart(ctx context.Context, store store.Store, lastPipeline *model.Pipelin } if len(configs) == 0 { - newPipeline, uerr := UpdateToStatusError(store, *newPipeline, errors.New("pipeline definition not found")) - if uerr != nil { - log.Debug().Err(uerr).Msg("failure to update pipeline status") + newPipeline, uErr := UpdateToStatusError(store, *newPipeline, errors.New("pipeline definition not found")) + if uErr != nil { + log.Debug().Err(uErr).Msg("failure to update pipeline status") } else { updatePipelineStatus(ctx, forge, newPipeline, repo, user) } diff --git a/server/services/config/http.go b/server/services/config/http.go index cb4138ac6..10bd87309 100644 --- a/server/services/config/http.go +++ b/server/services/config/http.go @@ -18,7 +18,7 @@ import ( "context" "crypto" "fmt" - nethttp "net/http" + net_http "net/http" "go.woodpecker-ci.org/woodpecker/v2/server/forge" "go.woodpecker-ci.org/woodpecker/v2/server/forge/types" @@ -76,7 +76,7 @@ func (h *http) Fetch(ctx context.Context, forge forge.Forge, user *model.User, r return nil, fmt.Errorf("failed to fetch config via http (%d) %w", status, err) } - if status != nethttp.StatusOK { + if status != net_http.StatusOK { return oldConfigData, nil } diff --git a/server/services/encryption/aes.go b/server/services/encryption/aes.go index 56a784e27..1cae9dd38 100644 --- a/server/services/encryption/aes.go +++ b/server/services/encryption/aes.go @@ -36,10 +36,10 @@ func (svc *aesEncryptionService) Encrypt(plaintext, associatedData string) (stri msg := []byte(plaintext) aad := []byte(associatedData) - nonce := random.GetRandomBytes(uint32(AESGCMSIVNonceSize)) + nonce := random.GetRandomBytes(uint32(AES_GCM_SIV_NonceSize)) ciphertext := svc.cipher.Seal(nil, nonce, msg, aad) - result := make([]byte, 0, AESGCMSIVNonceSize+len(ciphertext)) + result := make([]byte, 0, AES_GCM_SIV_NonceSize+len(ciphertext)) result = append(result, nonce...) result = append(result, ciphertext...) @@ -52,8 +52,8 @@ func (svc *aesEncryptionService) Decrypt(ciphertext, associatedData string) (str return "", fmt.Errorf(errTemplateBase64DecryptionFailed, err) } - nonce := bytes[:AESGCMSIVNonceSize] - message := bytes[AESGCMSIVNonceSize:] + nonce := bytes[:AES_GCM_SIV_NonceSize] + message := bytes[AES_GCM_SIV_NonceSize:] plaintext, err := svc.cipher.Open(nil, nonce, message, []byte(associatedData)) if err != nil { diff --git a/server/services/encryption/constants.go b/server/services/encryption/constants.go index 0ae7039dd..93b845839 100644 --- a/server/services/encryption/constants.go +++ b/server/services/encryption/constants.go @@ -28,8 +28,8 @@ const ( keyTypeRaw = "raw" keyTypeNone = "none" - keyIDAssociatedData = "Primary key id" - AESGCMSIVNonceSize = 12 + keyIDAssociatedData = "Primary key id" + AES_GCM_SIV_NonceSize = 12 //nolint:revive,stylecheck ) var ( diff --git a/server/services/encryption/tink_keyset.go b/server/services/encryption/tink_keyset.go index 482b17814..aaf7b84ae 100644 --- a/server/services/encryption/tink_keyset.go +++ b/server/services/encryption/tink_keyset.go @@ -21,7 +21,7 @@ import ( "strconv" "github.com/google/tink/go/aead" - "github.com/google/tink/go/insecurecleartextkeyset" + insecure_clear_text_keyset "github.com/google/tink/go/insecurecleartextkeyset" "github.com/google/tink/go/keyset" "github.com/rs/zerolog/log" @@ -42,7 +42,7 @@ func (svc *tinkEncryptionService) loadKeyset() error { }(file) jsonKeyset := keyset.NewJSONReader(file) - keysetHandle, err := insecurecleartextkeyset.Read(jsonKeyset) + keysetHandle, err := insecure_clear_text_keyset.Read(jsonKeyset) if err != nil { return fmt.Errorf(errTemplateTinkFailedReadingKeyset, err) } diff --git a/server/services/registry/filesystem.go b/server/services/registry/filesystem.go index c84a0f3e9..8faf400f5 100644 --- a/server/services/registry/filesystem.go +++ b/server/services/registry/filesystem.go @@ -21,7 +21,7 @@ import ( "os" "strings" - "github.com/docker/cli/cli/config/configfile" + config_file "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/cli/config/types" "go.woodpecker-ci.org/woodpecker/v2/server/model" @@ -46,7 +46,7 @@ func parseDockerConfig(path string) ([]*model.Registry, error) { } defer f.Close() - configFile := configfile.ConfigFile{ + configFile := config_file.ConfigFile{ AuthConfigs: make(map[string]types.AuthConfig), } @@ -73,16 +73,16 @@ func parseDockerConfig(path string) ([]*model.Registry, error) { } } - var auths []*model.Registry + var registries []*model.Registry for key, auth := range configFile.AuthConfigs { - auths = append(auths, &model.Registry{ + registries = append(registries, &model.Registry{ Address: key, Username: auth.Username, Password: auth.Password, }) } - return auths, nil + return registries, nil } func (f *filesystem) RegistryFind(*model.Repo, string) (*model.Registry, error) { diff --git a/woodpecker-go/woodpecker/client.go b/woodpecker-go/woodpecker/client.go index 81d87bc90..3a26f5dc2 100644 --- a/woodpecker-go/woodpecker/client.go +++ b/woodpecker-go/woodpecker/client.go @@ -80,28 +80,28 @@ func (c *client) SetLogLevel(in *LogLevel) (*LogLevel, error) { // // Helper function for making an http GET request. -func (c *client) get(rawurl string, out any) error { - return c.do(rawurl, http.MethodGet, nil, out) +func (c *client) get(rawURL string, out any) error { + return c.do(rawURL, http.MethodGet, nil, out) } // Helper function for making an http POST request. -func (c *client) post(rawurl string, in, out any) error { - return c.do(rawurl, http.MethodPost, in, out) +func (c *client) post(rawURL string, in, out any) error { + return c.do(rawURL, http.MethodPost, in, out) } // Helper function for making an http PATCH request. -func (c *client) patch(rawurl string, in, out any) error { - return c.do(rawurl, http.MethodPatch, in, out) +func (c *client) patch(rawURL string, in, out any) error { + return c.do(rawURL, http.MethodPatch, in, out) } // Helper function for making an http DELETE request. -func (c *client) delete(rawurl string) error { - return c.do(rawurl, http.MethodDelete, nil, nil) +func (c *client) delete(rawURL string) error { + return c.do(rawURL, http.MethodDelete, nil, nil) } // Helper function to make an http request. -func (c *client) do(rawurl, method string, in, out any) error { - body, err := c.open(rawurl, method, in) +func (c *client) do(rawURL, method string, in, out any) error { + body, err := c.open(rawURL, method, in) if err != nil { return err } @@ -113,8 +113,8 @@ func (c *client) do(rawurl, method string, in, out any) error { } // Helper function to open an http request. -func (c *client) open(rawurl, method string, in any) (io.ReadCloser, error) { - uri, err := url.Parse(rawurl) +func (c *client) open(rawURL, method string, in any) (io.ReadCloser, error) { + uri, err := url.Parse(rawURL) if err != nil { return nil, err }