diff --git a/.golangci.yaml b/.golangci.yaml
index 703304a52..391282e2c 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -108,7 +108,7 @@ linters-settings:
- standard
- default
- prefix(go.woodpecker-ci.org/woodpecker)
- gomnd:
+ mnd:
ignored-numbers:
- '0o600'
- '0o660'
@@ -121,6 +121,13 @@ linters-settings:
- strings.Split
- callerName
- securecookie.GenerateRandomKey
+ godot:
+ scope: toplevel
+ period: true
+ capital: true
+ exclude:
+ - '^\s*cSpell:'
+ - '^\s*TODO:'
linters:
disable-all: true
@@ -166,13 +173,14 @@ linters:
- contextcheck
- forcetypeassert
- gci
- - gomnd
+ - mnd
+ - godot
issues:
exclude-rules:
- path: 'fixtures|cmd/agent/flags.go|cmd/server/flags.go|pipeline/backend/kubernetes/flags.go|_test.go'
linters:
- - gomnd
+ - mnd
run:
timeout: 15m
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 6dd80d77e..f66d31f37 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -10,7 +10,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/golangci/golangci-lint
- rev: v1.57.2
+ rev: v1.58.1
hooks:
- id: golangci-lint
- repo: https://github.com/igorshubovych/markdownlint-cli
diff --git a/agent/rpc/auth_client_grpc.go b/agent/rpc/auth_client_grpc.go
index 94a01151e..9562f47ea 100644
--- a/agent/rpc/auth_client_grpc.go
+++ b/agent/rpc/auth_client_grpc.go
@@ -40,7 +40,7 @@ func NewAuthGrpcClient(conn *grpc.ClientConn, agentToken string, agentID int64)
}
func (c *AuthClient) Auth() (string, int64, error) {
- ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) //nolint: gomnd
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) //nolint:mnd
defer cancel()
req := &proto.AuthRequest{
diff --git a/agent/rpc/auth_interceptor.go b/agent/rpc/auth_interceptor.go
index d15e195b1..1283aa970 100644
--- a/agent/rpc/auth_interceptor.go
+++ b/agent/rpc/auth_interceptor.go
@@ -23,13 +23,13 @@ import (
"google.golang.org/grpc/metadata"
)
-// AuthInterceptor is a client interceptor for authentication
+// AuthInterceptor is a client interceptor for authentication.
type AuthInterceptor struct {
authClient *AuthClient
accessToken string
}
-// NewAuthInterceptor returns a new auth interceptor
+// NewAuthInterceptor returns a new auth interceptor.
func NewAuthInterceptor(
authClient *AuthClient,
refreshDuration time.Duration,
@@ -46,7 +46,7 @@ func NewAuthInterceptor(
return interceptor, nil
}
-// Unary returns a client interceptor to authenticate unary RPC
+// Unary returns a client interceptor to authenticate unary RPC.
func (interceptor *AuthInterceptor) Unary() grpc.UnaryClientInterceptor {
return func(
ctx context.Context,
@@ -60,7 +60,7 @@ func (interceptor *AuthInterceptor) Unary() grpc.UnaryClientInterceptor {
}
}
-// Stream returns a client interceptor to authenticate stream RPC
+// Stream returns a client interceptor to authenticate stream RPC.
func (interceptor *AuthInterceptor) Stream() grpc.StreamClientInterceptor {
return func(
ctx context.Context,
diff --git a/agent/rpc/client_grpc.go b/agent/rpc/client_grpc.go
index b0960b16e..2ee8f322a 100644
--- a/agent/rpc/client_grpc.go
+++ b/agent/rpc/client_grpc.go
@@ -31,7 +31,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/pipeline/rpc/proto"
)
-// set grpc version on compile time to compare against server version response
+// Set grpc version on compile time to compare against server version response.
const ClientGrpcVersion int32 = proto.Version
type client struct {
@@ -54,12 +54,12 @@ func (c *client) Close() error {
func (c *client) newBackOff() backoff.BackOff {
b := backoff.NewExponentialBackOff()
b.MaxElapsedTime = 0
- b.MaxInterval = 10 * time.Second //nolint: gomnd
- b.InitialInterval = 10 * time.Millisecond //nolint: gomnd
+ b.MaxInterval = 10 * time.Second //nolint:mnd
+ b.InitialInterval = 10 * time.Millisecond //nolint:mnd
return b
}
-// Version returns the server- & grpc-version
+// Version returns the server- & grpc-version.
func (c *client) Version(ctx context.Context) (*rpc.Version, error) {
res, err := c.client.Version(ctx, &proto.Empty{})
if err != nil {
@@ -242,7 +242,7 @@ func (c *client) Done(ctx context.Context, id string, state rpc.State) (err erro
return nil
}
-// Extend extends the workflow deadline
+// Extend extends the workflow deadline.
func (c *client) Extend(ctx context.Context, id string) (err error) {
retry := c.newBackOff()
req := new(proto.ExtendRequest)
diff --git a/agent/runner.go b/agent/runner.go
index 20fc1d40e..b80367bbd 100644
--- a/agent/runner.go
+++ b/agent/runner.go
@@ -198,12 +198,10 @@ func (r *Runner) Run(runnerCtx context.Context) error { //nolint:contextcheck
return nil
}
-// extract repository name from the configuration
func extractRepositoryName(config *backend.Config) string {
return config.Stages[0].Steps[0].Environment["CI_REPO"]
}
-// extract pipeline number from the configuration
func extractPipelineNumber(config *backend.Config) string {
return config.Stages[0].Steps[0].Environment["CI_PIPELINE_NUMBER"]
}
diff --git a/agent/tracer.go b/agent/tracer.go
index eef207f4f..7c516134c 100644
--- a/agent/tracer.go
+++ b/agent/tracer.go
@@ -40,7 +40,7 @@ func (r *Runner) createTracer(ctxmeta context.Context, logger zerolog.Logger, wo
StepUUID: state.Pipeline.Step.UUID,
Exited: state.Process.Exited,
ExitCode: state.Process.ExitCode,
- Started: time.Now().Unix(), // TODO do not do this
+ Started: time.Now().Unix(), // TODO: do not do this
Finished: time.Now().Unix(),
}
if state.Process.Error != nil {
diff --git a/cli/common/flags.go b/cli/common/flags.go
index fd59c9dea..c4f022dbe 100644
--- a/cli/common/flags.go
+++ b/cli/common/flags.go
@@ -65,7 +65,7 @@ var GlobalFlags = append([]cli.Flag{
}, logger.GlobalLoggerFlags...)
// FormatFlag return format flag with value set based on template
-// if hidden value is set, flag will be hidden
+// if hidden value is set, flag will be hidden.
func FormatFlag(tmpl string, hidden ...bool) *cli.StringFlag {
return &cli.StringFlag{
Name: "format",
diff --git a/cli/cron/cron_list.go b/cli/cron/cron_list.go
index 4a62e8c07..edd6c88d3 100644
--- a/cli/cron/cron_list.go
+++ b/cli/cron/cron_list.go
@@ -67,7 +67,7 @@ func cronList(c *cli.Context) error {
return nil
}
-// template for pipeline list information
+// tTemplate for pipeline list information.
var tmplCronList = "\x1b[33m{{ .Name }} \x1b[0m" + `
ID: {{ .ID }}
Branch: {{ .Branch }}
diff --git a/cli/deploy/deploy.go b/cli/deploy/deploy.go
index 9a9ffd32c..ff19ea983 100644
--- a/cli/deploy/deploy.go
+++ b/cli/deploy/deploy.go
@@ -126,7 +126,7 @@ func deploy(c *cli.Context) error {
return tmpl.Execute(os.Stdout, deploy)
}
-// template for deployment information
+// Template for deployment information.
var tmplDeployInfo = `Number: {{ .Number }}
Status: {{ .Status }}
Commit: {{ .Commit }}
diff --git a/cli/exec/exec.go b/cli/exec/exec.go
index b1907e6c4..cb65e1050 100644
--- a/cli/exec/exec.go
+++ b/cli/exec/exec.go
@@ -263,7 +263,7 @@ func convertPathForWindows(path string) string {
base := filepath.VolumeName(path)
// Check if path is volume name like C:
- //nolint: gomnd
+ //nolint:mnd
if len(base) == 2 {
path = strings.TrimPrefix(path, base)
base = strings.ToLower(strings.TrimSuffix(base, ":"))
diff --git a/cli/info/info.go b/cli/info/info.go
index e8d07145a..5963f4425 100644
--- a/cli/info/info.go
+++ b/cli/info/info.go
@@ -52,6 +52,6 @@ func info(c *cli.Context) error {
return tmpl.Execute(os.Stdout, user)
}
-// template for user information
+// Template for user information.
var tmplInfo = `User: {{ .Login }}
Email: {{ .Email }}`
diff --git a/cli/log/log_purge.go b/cli/log/log_purge.go
index fc03aa533..8a62ac79d 100644
--- a/cli/log/log_purge.go
+++ b/cli/log/log_purge.go
@@ -45,7 +45,7 @@ func logPurge(c *cli.Context) (err error) {
return err
}
- stepArg := c.Args().Get(2) //nolint: gomnd
+ stepArg := c.Args().Get(2) //nolint:mnd
// TODO: Add lookup by name: stepID, err := internal.ParseStep(client, repoID, stepIDOrName)
var stepID int64
if len(stepArg) != 0 {
diff --git a/cli/pipeline/list.go b/cli/pipeline/list.go
index 29158f3ce..6a3576323 100644
--- a/cli/pipeline/list.go
+++ b/cli/pipeline/list.go
@@ -22,7 +22,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker"
)
-//nolint:gomnd
+//nolint:mnd
var pipelineListCmd = &cli.Command{
Name: "ls",
Usage: "show pipeline history",
diff --git a/cli/pipeline/ps.go b/cli/pipeline/ps.go
index abf83d347..bba6f4043 100644
--- a/cli/pipeline/ps.go
+++ b/cli/pipeline/ps.go
@@ -83,7 +83,7 @@ func pipelinePs(c *cli.Context) error {
return nil
}
-// template for pipeline ps information
+// Template for pipeline ps information.
var tmplPipelinePs = "\x1b[33mStep #{{ .PID }} \x1b[0m" + `
Step: {{ .Name }}
State: {{ .State }}
diff --git a/cli/pipeline/queue.go b/cli/pipeline/queue.go
index 9678de7b1..1fbccd8a3 100644
--- a/cli/pipeline/queue.go
+++ b/cli/pipeline/queue.go
@@ -62,7 +62,7 @@ func pipelineQueue(c *cli.Context) error {
return nil
}
-// template for pipeline list information
+// Template for pipeline list information.
var tmplPipelineQueue = "\x1b[33m{{ .FullName }} #{{ .Number }} \x1b[0m" + `
Status: {{ .Status }}
Event: {{ .Event }}
diff --git a/cli/registry/registry_list.go b/cli/registry/registry_list.go
index f96238b70..99221903d 100644
--- a/cli/registry/registry_list.go
+++ b/cli/registry/registry_list.go
@@ -67,7 +67,7 @@ func registryList(c *cli.Context) error {
return nil
}
-// template for registry list information
+// Template for registry list information.
var tmplRegistryList = "\x1b[33m{{ .Address }} \x1b[0m" + `
Username: {{ .Username }}
Email: {{ .Email }}
diff --git a/cli/repo/repo_info.go b/cli/repo/repo_info.go
index ed308a4be..72d4bf7a6 100644
--- a/cli/repo/repo_info.go
+++ b/cli/repo/repo_info.go
@@ -55,7 +55,7 @@ func repoInfo(c *cli.Context) error {
return tmpl.Execute(os.Stdout, repo)
}
-// template for repo information
+// tTemplate for repo information.
var tmplRepoInfo = `Owner: {{ .Owner }}
Repo: {{ .Name }}
URL: {{ .ForgeURL }}
diff --git a/cli/repo/repo_list.go b/cli/repo/repo_list.go
index 2baa0670b..9aa569338 100644
--- a/cli/repo/repo_list.go
+++ b/cli/repo/repo_list.go
@@ -66,5 +66,5 @@ func repoList(c *cli.Context) error {
return nil
}
-// template for repository list items
+// Template for repository list items.
var tmplRepoList = "\x1b[33m{{ .FullName }}\x1b[0m (id: {{ .ID }}, forgeRemoteID: {{ .ForgeRemoteID }})"
diff --git a/cli/secret/secret_list.go b/cli/secret/secret_list.go
index 24d61fb0d..e698cb505 100644
--- a/cli/secret/secret_list.go
+++ b/cli/secret/secret_list.go
@@ -86,7 +86,7 @@ func secretList(c *cli.Context) error {
return nil
}
-// template for secret list items
+// Template for secret list items.
var tmplSecretList = "\x1b[33m{{ .Name }} \x1b[0m" + `
Events: {{ list .Events }}
{{- if .Images }}
diff --git a/cli/user/user_info.go b/cli/user/user_info.go
index 62abe2713..7747f5d18 100644
--- a/cli/user/user_info.go
+++ b/cli/user/user_info.go
@@ -56,6 +56,6 @@ func userInfo(c *cli.Context) error {
return tmpl.Execute(os.Stdout, user)
}
-// template for user information
+// Template for user information.
var tmplUserInfo = `User: {{ .Login }}
Email: {{ .Email }}`
diff --git a/cli/user/user_list.go b/cli/user/user_list.go
index 914f04e63..63863b95f 100644
--- a/cli/user/user_list.go
+++ b/cli/user/user_list.go
@@ -55,5 +55,5 @@ func userList(c *cli.Context) error {
return nil
}
-// template for user list items
+// Template for user list items.
var tmplUserList = `{{ .Login }}`
diff --git a/cmd/agent/core/agent.go b/cmd/agent/core/agent.go
index c845222dc..e2c8a3e20 100644
--- a/cmd/agent/core/agent.go
+++ b/cmd/agent/core/agent.go
@@ -89,7 +89,7 @@ func run(c *cli.Context, backends []types.Backend) error {
agentToken := c.String("grpc-token")
authClient := agentRpc.NewAuthGrpcClient(authConn, agentToken, agentConfig.AgentID)
- authInterceptor, err := agentRpc.NewAuthInterceptor(authClient, 30*time.Minute) //nolint: gomnd
+ authInterceptor, err := agentRpc.NewAuthInterceptor(authClient, 30*time.Minute) //nolint:mnd
if err != nil {
return err
}
diff --git a/cmd/agent/core/flags.go b/cmd/agent/core/flags.go
index 1034438f2..efd747f8f 100644
--- a/cmd/agent/core/flags.go
+++ b/cmd/agent/core/flags.go
@@ -22,7 +22,7 @@ import (
"github.com/urfave/cli/v2"
)
-//nolint:gomnd
+//nolint:mnd
var flags = []cli.Flag{
&cli.StringFlag{
EnvVars: []string{"WOODPECKER_SERVER"},
diff --git a/cmd/agent/core/health.go b/cmd/agent/core/health.go
index c05765bcc..263bd3269 100644
--- a/cmd/agent/core/health.go
+++ b/cmd/agent/core/health.go
@@ -27,7 +27,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/version"
)
-// the file implements some basic healthcheck logic based on the
+// The file implements some basic healthcheck logic based on the
// following specification:
// https://github.com/mozilla-services/Dockerflow
@@ -74,7 +74,7 @@ type versionResp struct {
Source string `json:"source"`
}
-// default statistics counter
+// Default statistics counter.
var counter = &agent.State{
Metadata: map[string]agent.Info{},
}
diff --git a/cmd/agent/core/run.go b/cmd/agent/core/run.go
index b485f5019..9c64fec3d 100644
--- a/cmd/agent/core/run.go
+++ b/cmd/agent/core/run.go
@@ -17,7 +17,7 @@ package core
import (
"os"
- // Load config from .env
+ // Load config from .env file.
_ "github.com/joho/godotenv/autoload"
"github.com/rs/zerolog/log"
"github.com/urfave/cli/v2"
diff --git a/cmd/server/swagger.go b/cmd/server/swagger.go
index d1cefccae..c38e5dd62 100644
--- a/cmd/server/swagger.go
+++ b/cmd/server/swagger.go
@@ -19,7 +19,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/version"
)
-// generate docs/swagger.json via:
+// Generate docs/swagger.json via:
//go:generate go run woodpecker_docs_gen.go swagger.go
//go:generate go run github.com/go-swagger/go-swagger/cmd/swagger@latest validate ../../docs/swagger.json
diff --git a/pipeline/backend/common/script_posix.go b/pipeline/backend/common/script_posix.go
index 86ff0a0c1..56bf06111 100644
--- a/pipeline/backend/common/script_posix.go
+++ b/pipeline/backend/common/script_posix.go
@@ -22,7 +22,7 @@ import (
)
// generateScriptPosix is a helper function that generates a step script
-// for a linux container using the given
+// for a linux container using the given.
func generateScriptPosix(commands []string) string {
var buf bytes.Buffer
diff --git a/pipeline/backend/kubernetes/backend_options.go b/pipeline/backend/kubernetes/backend_options.go
index a1d82067e..da3644670 100644
--- a/pipeline/backend/kubernetes/backend_options.go
+++ b/pipeline/backend/kubernetes/backend_options.go
@@ -6,7 +6,7 @@ import (
backend "go.woodpecker-ci.org/woodpecker/v2/pipeline/backend/types"
)
-// BackendOptions defines all the advanced options for the kubernetes backend
+// BackendOptions defines all the advanced options for the kubernetes backend.
type BackendOptions struct {
Resources Resources `mapstructure:"resources"`
RuntimeClassName *string `mapstructure:"runtimeClassName"`
@@ -18,13 +18,13 @@ type BackendOptions struct {
SecurityContext *SecurityContext `mapstructure:"securityContext"`
}
-// Resources defines two maps for kubernetes resource definitions
+// Resources defines two maps for kubernetes resource definitions.
type Resources struct {
Requests map[string]string `mapstructure:"requests"`
Limits map[string]string `mapstructure:"limits"`
}
-// Toleration defines Kubernetes toleration
+// Toleration defines Kubernetes toleration.
type Toleration struct {
Key string `mapstructure:"key"`
Operator TolerationOperator `mapstructure:"operator"`
diff --git a/pipeline/backend/kubernetes/kubernetes.go b/pipeline/backend/kubernetes/kubernetes.go
index 00f5c1b7e..07014aef0 100644
--- a/pipeline/backend/kubernetes/kubernetes.go
+++ b/pipeline/backend/kubernetes/kubernetes.go
@@ -32,8 +32,7 @@ import (
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
- // To authenticate to GCP K8s clusters
- _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
+ _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" // To authenticate to GCP K8s clusters
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/cache"
@@ -42,7 +41,7 @@ import (
const (
EngineName = "kubernetes"
- // TODO 5 seconds is against best practice, k3s didn't work otherwise
+ // TODO: 5 seconds is against best practice, k3s didn't work otherwise
defaultResyncDuration = 5 * time.Second
)
@@ -268,7 +267,7 @@ func (e *kube) WaitStep(ctx context.Context, step *types.Step, taskUUID string)
si.Start(stop)
defer close(stop)
- // TODO Cancel on ctx.Done
+ // TODO: Cancel on ctx.Done
<-finished
pod, err := e.client.CoreV1().Pods(e.config.Namespace).Get(ctx, podName, metav1.GetOptions{})
diff --git a/pipeline/backend/kubernetes/pod.go b/pipeline/backend/kubernetes/pod.go
index 2481e90c7..99ed99e6e 100644
--- a/pipeline/backend/kubernetes/pod.go
+++ b/pipeline/backend/kubernetes/pod.go
@@ -268,7 +268,7 @@ func containerPort(port types.Port) v1.ContainerPort {
}
}
-// Here is the service IPs (placed in /etc/hosts in the Pod)
+// Here is the service IPs (placed in /etc/hosts in the Pod).
func hostAliases(extraHosts []types.HostAlias) []v1.HostAlias {
var hostAliases []v1.HostAlias
for _, extraHost := range extraHosts {
diff --git a/pipeline/backend/kubernetes/utils.go b/pipeline/backend/kubernetes/utils.go
index c1a947e1b..39606bd75 100644
--- a/pipeline/backend/kubernetes/utils.go
+++ b/pipeline/backend/kubernetes/utils.go
@@ -65,7 +65,7 @@ func isImagePullBackOffState(pod *v1.Pod) bool {
return false
}
-// getClientOutOfCluster returns a k8s clientset to the request from outside of cluster
+// getClientOutOfCluster returns a k8s clientset to the request from outside of cluster.
func getClientOutOfCluster() (kubernetes.Interface, error) {
kubeConfigPath := os.Getenv("KUBECONFIG")
if kubeConfigPath == "" {
@@ -81,7 +81,7 @@ func getClientOutOfCluster() (kubernetes.Interface, error) {
return kubernetes.NewForConfig(config)
}
-// getClient returns a k8s clientset to the request from inside of cluster
+// getClient returns a k8s clientset to the request from inside of cluster.
func getClientInsideOfCluster() (kubernetes.Interface, error) {
config, err := rest.InClusterConfig()
if err != nil {
diff --git a/pipeline/backend/local/clone.go b/pipeline/backend/local/clone.go
index 795b12b20..4a9bb5ff4 100644
--- a/pipeline/backend/local/clone.go
+++ b/pipeline/backend/local/clone.go
@@ -30,13 +30,13 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/pipeline/backend/types"
)
-// checkGitCloneCap check if we have the git binary on hand
+// checkGitCloneCap check if we have the git binary on hand.
func checkGitCloneCap() error {
_, err := exec.LookPath("git")
return err
}
-// loadClone on backend start determine if there is a global plugin-git binary
+// loadClone on backend start determine if there is a global plugin-git binary.
func (e *local) loadClone() {
binary, err := exec.LookPath("plugin-git")
if err != nil || binary == "" {
@@ -46,7 +46,7 @@ func (e *local) loadClone() {
e.pluginGitBinary = binary
}
-// setupClone prepare the clone environment before exec
+// setupClone prepare the clone environment before exec.
func (e *local) setupClone(state *workflowState) error {
if e.pluginGitBinary != "" {
state.pluginGitBinary = e.pluginGitBinary
@@ -61,7 +61,7 @@ func (e *local) setupClone(state *workflowState) error {
return e.downloadLatestGitPluginBinary(state.pluginGitBinary)
}
-// execClone executes a clone-step locally
+// execClone executes a clone-step locally.
func (e *local) execClone(ctx context.Context, step *types.Step, state *workflowState, env []string) error {
if scm := step.Environment["CI_REPO_SCM"]; scm != "git" {
return fmt.Errorf("local backend can only clone from git repos, but this repo use '%s'", scm)
@@ -113,7 +113,7 @@ func (e *local) execClone(ctx context.Context, step *types.Step, state *workflow
return cmd.Start()
}
-// writeNetRC write a netrc file into the home dir of a given workflow state
+// writeNetRC write a netrc file into the home dir of a given workflow state.
func (e *local) writeNetRC(step *types.Step, state *workflowState) (string, error) {
if step.Environment["CI_NETRC_MACHINE"] == "" {
log.Trace().Msg("no netrc to write")
@@ -132,7 +132,7 @@ func (e *local) writeNetRC(step *types.Step, state *workflowState) (string, erro
}
// downloadLatestGitPluginBinary download the latest plugin-git binary based on runtime OS and Arch
-// and saves it to dest
+// and saves it to dest.
func (e *local) downloadLatestGitPluginBinary(dest string) error {
type asset struct {
Name string
diff --git a/pipeline/backend/local/const.go b/pipeline/backend/local/const.go
index 0940cb8dc..4c53de89f 100644
--- a/pipeline/backend/local/const.go
+++ b/pipeline/backend/local/const.go
@@ -19,7 +19,7 @@ import (
"fmt"
)
-// notAllowedEnvVarOverwrites are all env vars that cannot be overwritten by step config
+// notAllowedEnvVarOverwrites are all env vars that cannot be overwritten by step config.
var notAllowedEnvVarOverwrites = []string{
"CI_NETRC_MACHINE",
"CI_NETRC_USERNAME",
diff --git a/pipeline/backend/local/local.go b/pipeline/backend/local/local.go
index cd96b470c..08f6abd16 100644
--- a/pipeline/backend/local/local.go
+++ b/pipeline/backend/local/local.go
@@ -147,10 +147,10 @@ func (e *local) StartStep(ctx context.Context, step *types.Step, taskUUID string
}
}
-// execCommands use step.Image as shell and run the commands in it
+// execCommands use step.Image as shell and run the commands in it.
func (e *local) execCommands(ctx context.Context, step *types.Step, state *workflowState, env []string) error {
// Prepare commands
- // TODO support `entrypoint` from pipeline config
+ // TODO: support `entrypoint` from pipeline config
args, err := e.genCmdByShell(step.Image, step.Commands)
if err != nil {
return fmt.Errorf("could not convert commands into args: %w", err)
@@ -176,7 +176,7 @@ func (e *local) execCommands(ctx context.Context, step *types.Step, state *workf
return cmd.Start()
}
-// execPlugin use step.Image as exec binary
+// execPlugin use step.Image as exec binary.
func (e *local) execPlugin(ctx context.Context, step *types.Step, state *workflowState, env []string) error {
binary, err := exec.LookPath(step.Image)
if err != nil {
diff --git a/pipeline/backend/types/backend.go b/pipeline/backend/types/backend.go
index b3ae38705..0ef6b6859 100644
--- a/pipeline/backend/types/backend.go
+++ b/pipeline/backend/types/backend.go
@@ -56,7 +56,7 @@ type Backend interface {
DestroyWorkflow(ctx context.Context, conf *Config, taskUUID string) error
}
-// BackendInfo represents the reported information of a loaded backend
+// BackendInfo represents the reported information of a loaded backend.
type BackendInfo struct {
Platform string
}
diff --git a/pipeline/backend/types/config.go b/pipeline/backend/types/config.go
index 0fe1e6fc0..16843a830 100644
--- a/pipeline/backend/types/config.go
+++ b/pipeline/backend/types/config.go
@@ -22,7 +22,7 @@ type Config struct {
Secrets []*Secret `json:"secrets"` // secret definitions
}
-// CliContext is the context key to pass cli context to backends if needed
+// CliContext is the context key to pass cli context to backends if needed.
var CliContext ContextKey
// ContextKey is just an empty struct. It exists so CliContext can be
diff --git a/pipeline/backend/types/secret.go b/pipeline/backend/types/secret.go
index 7a7b2ecb1..8287fe789 100644
--- a/pipeline/backend/types/secret.go
+++ b/pipeline/backend/types/secret.go
@@ -14,7 +14,7 @@
package types
-// Secret defines a runtime secret
+// Secret defines a runtime secret.
type Secret struct {
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
diff --git a/pipeline/backend/types/step.go b/pipeline/backend/types/step.go
index 9eb61fc06..6eb3471b9 100644
--- a/pipeline/backend/types/step.go
+++ b/pipeline/backend/types/step.go
@@ -49,7 +49,7 @@ type Step struct {
BackendOptions map[string]any `json:"backend_options,omitempty"`
}
-// StepType identifies the type of step
+// StepType identifies the type of step.
type StepType string
const (
diff --git a/pipeline/frontend/metadata/const.go b/pipeline/frontend/metadata/const.go
index a8777ffec..f00ed1709 100644
--- a/pipeline/frontend/metadata/const.go
+++ b/pipeline/frontend/metadata/const.go
@@ -26,9 +26,11 @@ const (
EventManual = "manual"
)
-// Different ways to handle failure states
+// Different ways to handle failure states.
const (
FailureIgnore = "ignore"
FailureFail = "fail"
- // FailureCancel = "cancel" // Not implemented yet
+ //nolint:godot
+ // TODO: Not implemented yet.
+ // FailureCancel = "cancel"
)
diff --git a/pipeline/frontend/metadata/environment.go b/pipeline/frontend/metadata/environment.go
index 7068aba01..782ccfce1 100644
--- a/pipeline/frontend/metadata/environment.go
+++ b/pipeline/frontend/metadata/environment.go
@@ -38,7 +38,7 @@ func (m *Metadata) Environ() map[string]string {
)
branchParts := strings.Split(m.Curr.Commit.Refspec, ":")
- if len(branchParts) == 2 { //nolint: gomnd
+ if len(branchParts) == 2 { //nolint:mnd
sourceBranch = branchParts[0]
targetBranch = branchParts[1]
}
@@ -124,7 +124,7 @@ func (m *Metadata) Environ() map[string]string {
"CI_FORGE_TYPE": m.Forge.Type,
"CI_FORGE_URL": m.Forge.URL,
- // TODO Deprecated, remove in 3.x
+ // TODO: Deprecated, remove in 3.x
"CI_COMMIT_URL": m.Curr.ForgeURL,
}
if m.Curr.Event == EventTag || m.Curr.Event == EventRelease || strings.HasPrefix(m.Curr.Commit.Ref, "refs/tags/") {
diff --git a/pipeline/frontend/metadata/types.go b/pipeline/frontend/metadata/types.go
index 932bb0a63..ef2299479 100644
--- a/pipeline/frontend/metadata/types.go
+++ b/pipeline/frontend/metadata/types.go
@@ -93,7 +93,7 @@ type (
Number int `json:"number,omitempty"`
}
- // Secret defines a runtime secret
+ // Secret defines a runtime secret.
Secret struct {
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
@@ -110,13 +110,13 @@ type (
Version string `json:"version,omitempty"`
}
- // Forge defines runtime metadata about the forge that host the repo
+ // Forge defines runtime metadata about the forge that host the repo.
Forge struct {
Type string `json:"type,omitempty"`
URL string `json:"url,omitempty"`
}
- // ServerForge represent the needed func of a server forge to get its metadata
+ // ServerForge represent the needed func of a server forge to get its metadata.
ServerForge interface {
// Name returns the string name of this driver
Name() string
diff --git a/pipeline/frontend/yaml/compiler/compiler.go b/pipeline/frontend/yaml/compiler/compiler.go
index 2a7803349..5db566513 100644
--- a/pipeline/frontend/yaml/compiler/compiler.go
+++ b/pipeline/frontend/yaml/compiler/compiler.go
@@ -28,7 +28,7 @@ const (
defaultCloneName = "clone"
)
-// Registry represents registry credentials
+// Registry represents registry credentials.
type Registry struct {
Hostname string
Username string
@@ -89,7 +89,7 @@ type ResourceLimit struct {
CPUSet string
}
-// Compiler compiles the yaml
+// Compiler compiles the yaml.
type Compiler struct {
local bool
escalated []string
diff --git a/pipeline/frontend/yaml/compiler/convert.go b/pipeline/frontend/yaml/compiler/convert.go
index c36ef9734..92d68fe45 100644
--- a/pipeline/frontend/yaml/compiler/convert.go
+++ b/pipeline/frontend/yaml/compiler/convert.go
@@ -122,7 +122,7 @@ func (c *Compiler) createProcess(container *yaml_types.Container, stepType backe
}
environment[requested.Target] = secretValue
- // TODO deprecated, remove in 3.x
+ // TODO: deprecated, remove in 3.x
environment[strings.ToUpper(requested.Target)] = secretValue
}
diff --git a/pipeline/frontend/yaml/compiler/option.go b/pipeline/frontend/yaml/compiler/option.go
index e4730d497..c9194be62 100644
--- a/pipeline/frontend/yaml/compiler/option.go
+++ b/pipeline/frontend/yaml/compiler/option.go
@@ -150,7 +150,7 @@ func WithEnviron(env map[string]string) Option {
}
// WithNetworks configures the compiler with additional networks
-// to be connected to pipeline containers
+// to be connected to pipeline containers.
func WithNetworks(networks ...string) Option {
return func(compiler *Compiler) {
compiler.networks = networks
@@ -178,14 +178,14 @@ func WithDefaultCloneImage(cloneImage string) Option {
}
}
-// WithTrusted configures the compiler with the trusted repo option
+// WithTrusted configures the compiler with the trusted repo option.
func WithTrusted(trusted bool) Option {
return func(compiler *Compiler) {
compiler.trustedPipeline = trusted
}
}
-// WithNetrcOnlyTrusted configures the compiler with the netrcOnlyTrusted repo option
+// WithNetrcOnlyTrusted configures the compiler with the netrcOnlyTrusted repo option.
func WithNetrcOnlyTrusted(only bool) Option {
return func(compiler *Compiler) {
compiler.netrcOnlyTrusted = only
diff --git a/pipeline/frontend/yaml/compiler/settings/params.go b/pipeline/frontend/yaml/compiler/settings/params.go
index 73505e206..08cdf26e9 100644
--- a/pipeline/frontend/yaml/compiler/settings/params.go
+++ b/pipeline/frontend/yaml/compiler/settings/params.go
@@ -42,7 +42,7 @@ func ParamsToEnv(from map[string]any, to map[string]string, prefix string, upper
return nil
}
-// format the environment variable key
+// sanitizeParamKey formats the environment variable key.
func sanitizeParamKey(prefix string, upper bool, k string) string {
r := strings.ReplaceAll(strings.ReplaceAll(k, ".", "_"), "-", "_")
if upper {
@@ -51,7 +51,7 @@ func sanitizeParamKey(prefix string, upper bool, k string) string {
return prefix + r
}
-// indicate if a data type can be turned into string without encoding as json
+// isComplex indicate if a data type can be turned into string without encoding as json.
func isComplex(t reflect.Kind) bool {
switch t {
case reflect.Bool,
@@ -64,7 +64,7 @@ func isComplex(t reflect.Kind) bool {
}
}
-// sanitizeParamValue returns the value of a setting as string prepared to be injected as environment variable
+// sanitizeParamValue returns the value of a setting as string prepared to be injected as environment variable.
func sanitizeParamValue(v any, getSecretValue func(name string) (string, error)) (string, error) {
t := reflect.TypeOf(v)
vv := reflect.ValueOf(v)
@@ -141,7 +141,7 @@ func sanitizeParamValue(v any, getSecretValue func(name string) (string, error))
return handleComplex(vv.Interface(), getSecretValue)
}
-// handleComplex uses yaml2json to get json strings as values for environment variables
+// handleComplex uses yaml2json to get json strings as values for environment variables.
func handleComplex(v any, getSecretValue func(name string) (string, error)) (string, error) {
v, err := injectSecretRecursive(v, getSecretValue)
if err != nil {
@@ -161,7 +161,7 @@ func handleComplex(v any, getSecretValue func(name string) (string, error)) (str
// injectSecret probes if a map is a from_secret request.
// If it's a from_secret request it either returns the secret value or an error if the secret was not found
-// else it just indicates to progress normally using the provided map as is
+// else it just indicates to progress normally using the provided map as is.
func injectSecret(v map[string]any, getSecretValue func(name string) (string, error)) (string, bool, error) {
if secretNameI, ok := v["from_secret"]; ok {
if secretName, ok := secretNameI.(string); ok {
@@ -178,7 +178,7 @@ func injectSecret(v map[string]any, getSecretValue func(name string) (string, er
}
// injectSecretRecursive iterates over all types and if they contain elements
-// it iterates recursively over them too, using injectSecret internally
+// it iterates recursively over them too, using injectSecret internally.
func injectSecretRecursive(v any, getSecretValue func(name string) (string, error)) (any, error) {
t := reflect.TypeOf(v)
diff --git a/pipeline/frontend/yaml/constraint/constraint.go b/pipeline/frontend/yaml/constraint/constraint.go
index 1d08ecb09..9c562e4a7 100644
--- a/pipeline/frontend/yaml/constraint/constraint.go
+++ b/pipeline/frontend/yaml/constraint/constraint.go
@@ -49,7 +49,7 @@ type (
Local yamlBaseTypes.BoolTrue
Path Path
Evaluate string `yaml:"evaluate,omitempty"`
- // TODO change to StringOrSlice in 3.x
+ // TODO: change to StringOrSlice in 3.x
Event List
}
@@ -122,7 +122,7 @@ func (when *When) IncludesStatusSuccess() bool {
return false
}
-// False if (any) non local
+// False if (any) non local.
func (when *When) IsLocal() bool {
for _, c := range when.Constraints {
if !c.Local.Bool() {
@@ -206,7 +206,7 @@ func (c *Constraint) Match(m metadata.Metadata, global bool, env map[string]stri
return match, nil
}
-// IsEmpty return true if a constraint has no conditions
+// IsEmpty return true if a constraint has no conditions.
func (c List) IsEmpty() bool {
return len(c.Include) == 0 && len(c.Exclude) == 0
}
diff --git a/pipeline/frontend/yaml/linter/schema/schema.go b/pipeline/frontend/yaml/linter/schema/schema.go
index fae863627..4666faa7e 100644
--- a/pipeline/frontend/yaml/linter/schema/schema.go
+++ b/pipeline/frontend/yaml/linter/schema/schema.go
@@ -29,7 +29,7 @@ import (
//go:embed schema.json
var schemaDefinition []byte
-// Lint lints an io.Reader against the Woodpecker schema.json
+// Lint lints an io.Reader against the Woodpecker `schema.json`.
func Lint(r io.Reader) ([]gojsonschema.ResultError, error) {
schemaLoader := gojsonschema.NewBytesLoader(schemaDefinition)
diff --git a/pipeline/frontend/yaml/types/base/int.go b/pipeline/frontend/yaml/types/base/int.go
index 26565f2d2..e478415d5 100644
--- a/pipeline/frontend/yaml/types/base/int.go
+++ b/pipeline/frontend/yaml/types/base/int.go
@@ -46,7 +46,7 @@ func (s *StringOrInt) UnmarshalYAML(unmarshal func(any) error) error {
}
// MemStringOrInt represents a string or an integer
-// the String supports notations like 10m for then Megabyte of memory
+// the String supports notations like 10m for then Megabyte of memory.
type MemStringOrInt int64
// UnmarshalYAML implements the Unmarshaler interface.
diff --git a/pipeline/frontend/yaml/types/base/map.go b/pipeline/frontend/yaml/types/base/map.go
index daa83a44f..2cdd35b8b 100644
--- a/pipeline/frontend/yaml/types/base/map.go
+++ b/pipeline/frontend/yaml/types/base/map.go
@@ -20,7 +20,7 @@ import (
"strings"
)
-// SliceOrMap represents a map of strings, string slice are converted into a map
+// SliceOrMap represents a map of strings, string slice are converted into a map.
type SliceOrMap map[string]any
// UnmarshalYAML implements the Unmarshaler interface.
diff --git a/pipeline/frontend/yaml/types/container.go b/pipeline/frontend/yaml/types/container.go
index 363ed189f..6de8ab9e7 100644
--- a/pipeline/frontend/yaml/types/container.go
+++ b/pipeline/frontend/yaml/types/container.go
@@ -49,9 +49,9 @@ type (
Ports []string `yaml:"ports,omitempty"`
DependsOn base.StringOrSlice `yaml:"depends_on,omitempty"`
- // TODO make []string in 3.x
+ // TODO: make []string in 3.x
Secrets Secrets `yaml:"secrets,omitempty"`
- // TODO make map[string]any in 3.x
+ // TODO: make map[string]any in 3.x
Environment base.SliceOrMap `yaml:"environment,omitempty"`
// Docker and Kubernetes Specific
diff --git a/pipeline/frontend/yaml/types/volume.go b/pipeline/frontend/yaml/types/volume.go
index 3d925e25b..90d011b85 100644
--- a/pipeline/frontend/yaml/types/volume.go
+++ b/pipeline/frontend/yaml/types/volume.go
@@ -26,7 +26,7 @@ type Volumes struct {
Volumes []*Volume
}
-// Volume represent a service volume
+// Volume represent a service volume.
type Volume struct {
Source string `yaml:"-"`
Destination string `yaml:"-"`
@@ -68,7 +68,7 @@ func (v *Volumes) UnmarshalYAML(unmarshal func(any) error) error {
}
elts := strings.SplitN(name, ":", 3)
var vol *Volume
- //nolint: gomnd
+ //nolint:mnd
switch {
case len(elts) == 1:
vol = &Volume{
diff --git a/pipeline/pipeline.go b/pipeline/pipeline.go
index a68277f42..7267c6a57 100644
--- a/pipeline/pipeline.go
+++ b/pipeline/pipeline.go
@@ -88,7 +88,7 @@ func (r *Runtime) MakeLogger() zerolog.Logger {
return logCtx.Logger()
}
-// Run starts the execution of a workflow and waits for it to complete
+// Run starts the execution of a workflow and waits for it to complete.
func (r *Runtime) Run(runnerCtx context.Context) error {
logger := r.MakeLogger()
logger.Debug().Msgf("executing %d stages, in order of:", len(r.spec.Stages))
@@ -129,7 +129,7 @@ func (r *Runtime) Run(runnerCtx context.Context) error {
return r.err
}
-// Updates the current status of a step
+// Updates the current status of a step.
func (r *Runtime) traceStep(processState *backend.State, err error, step *backend.Step) error {
if r.tracer == nil {
// no tracer nothing to trace :)
@@ -158,7 +158,7 @@ func (r *Runtime) traceStep(processState *backend.State, err error, step *backen
return err
}
-// Executes a set of parallel steps
+// Executes a set of parallel steps.
func (r *Runtime) execAll(steps []*backend.Step) <-chan error {
var g errgroup.Group
done := make(chan error)
diff --git a/pipeline/rpc/log_entry.go b/pipeline/rpc/log_entry.go
index e62ce7a07..c489c7640 100644
--- a/pipeline/rpc/log_entry.go
+++ b/pipeline/rpc/log_entry.go
@@ -97,12 +97,12 @@ func (w *LineWriter) Write(p []byte) (n int, err error) {
return len(p), nil
}
-// Lines returns the line history
+// Lines returns the line history.
func (w *LineWriter) Lines() []*LogEntry {
return w.lines
}
-// Clear clears the line history
+// Clear clears the line history.
func (w *LineWriter) Clear() {
w.lines = w.lines[:0]
}
diff --git a/pipeline/rpc/proto/version.go b/pipeline/rpc/proto/version.go
index 8fd77ac94..9c4bfc91c 100644
--- a/pipeline/rpc/proto/version.go
+++ b/pipeline/rpc/proto/version.go
@@ -15,5 +15,5 @@
package proto
// Version is the version of the woodpecker.proto file,
-// !IMPORTANT! increased by 1 each time it get changed !IMPORTANT!
+// IMPORTANT: increased by 1 each time it get changed.
const Version int32 = 7
diff --git a/server/api/badge.go b/server/api/badge.go
index f3e8d2a03..a06fd8bb2 100644
--- a/server/api/badge.go
+++ b/server/api/badge.go
@@ -13,8 +13,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-// This file has been modified by Informatyka Boguslawski sp. z o.o. sp.k.
package api
diff --git a/server/api/hook.go b/server/api/hook.go
index 8046d289f..ea5031de4 100644
--- a/server/api/hook.go
+++ b/server/api/hook.go
@@ -13,8 +13,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-// This file has been modified by Informatyka Boguslawski sp. z o.o. sp.k.
package api
diff --git a/server/api/metrics/prometheus.go b/server/api/metrics/prometheus.go
index 1b68f7151..594de1760 100644
--- a/server/api/metrics/prometheus.go
+++ b/server/api/metrics/prometheus.go
@@ -28,7 +28,7 @@ import (
// errInvalidToken is returned when the api request token is invalid.
var errInvalidToken = errors.New("invalid or missing token")
-// PromHandler will pass the call from /api/metrics/prometheus to prometheus
+// PromHandler will pass the call from /api/metrics/prometheus to prometheus.
func PromHandler() gin.HandlerFunc {
handler := promhttp.Handler()
diff --git a/server/api/pipeline.go b/server/api/pipeline.go
index b3471918c..ed077b088 100644
--- a/server/api/pipeline.go
+++ b/server/api/pipeline.go
@@ -13,8 +13,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-// This file has been modified by Informatyka Boguslawski sp. z o.o. sp.k.
package api
@@ -551,7 +549,7 @@ func PostPipeline(c *gin.Context) {
pl.DeployTask = c.DefaultQuery("deploy_task", pl.DeployTask)
// make Event overridable to deploy
- // TODO refactor to use own proper API for deploy
+ // TODO: refactor to use own proper API for deploy
if event, ok := c.GetQuery("event"); ok {
pl.Event = model.WebhookEvent(event)
if pl.Event != model.EventDeploy {
diff --git a/server/badges/badges.go b/server/badges/badges.go
index 528af0922..e06df2327 100644
--- a/server/badges/badges.go
+++ b/server/badges/badges.go
@@ -24,7 +24,7 @@ var (
badgeNone = ``
)
-// Generate an SVG badge based on a pipeline
+// Generate an SVG badge based on a pipeline.
func Generate(pipeline *model.Pipeline) string {
if pipeline == nil {
return badgeNone
diff --git a/server/badges/badges_test.go b/server/badges/badges_test.go
index fdbefe195..4f34488c4 100644
--- a/server/badges/badges_test.go
+++ b/server/badges/badges_test.go
@@ -22,7 +22,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/server/model"
)
-// Generate an SVG badge based on a pipeline
+// Generate an SVG badge based on a pipeline.
func TestGenerate(t *testing.T) {
assert.Equal(t, badgeNone, Generate(nil))
assert.Equal(t, badgeSuccess, Generate(&model.Pipeline{Status: model.StatusSuccess}))
diff --git a/server/cache/membership.go b/server/cache/membership.go
index 38926540f..c29aafdb0 100644
--- a/server/cache/membership.go
+++ b/server/cache/membership.go
@@ -41,7 +41,7 @@ type membershipCache struct {
// NewMembershipService creates a new membership service.
func NewMembershipService(_store store.Store) MembershipService {
return &membershipCache{
- ttl: 10 * time.Minute, //nolint: gomnd
+ ttl: 10 * time.Minute, //nolint:mnd
store: _store,
cache: ttlcache.New(ttlcache.WithDisableTouchOnHit[string, *model.OrgPerm]()),
}
diff --git a/server/config.go b/server/config.go
index e8ac177ee..7df174504 100644
--- a/server/config.go
+++ b/server/config.go
@@ -12,8 +12,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-// This file has been modified by Informatyka Boguslawski sp. z o.o. sp.k.
package server
diff --git a/server/cron/cron.go b/server/cron/cron.go
index b3331f46c..a1dcddd29 100644
--- a/server/cron/cron.go
+++ b/server/cron/cron.go
@@ -30,14 +30,14 @@ import (
)
const (
- // checkTime specifies the interval woodpecker checks for new crons to exec
+ // Specifies the interval woodpecker checks for new crons to exec.
checkTime = 10 * time.Second
- // checkItems specifies the batch size of crons to retrieve per check from database
+ // Specifies the batch size of crons to retrieve per check from database.
checkItems = 10
)
-// Start starts the cron scheduler loop
+// Start starts the cron scheduler loop.
func Start(ctx context.Context, store store.Store) error {
for {
select {
@@ -64,7 +64,7 @@ func Start(ctx context.Context, store store.Store) error {
}
}
-// CalcNewNext parses a cron string and calculates the next exec time based on it
+// CalcNewNext parses a cron string and calculates the next exec time based on it.
func CalcNewNext(schedule string, now time.Time) (time.Time, error) {
// remove local timezone
now = now.UTC()
diff --git a/server/forge/addon/args.go b/server/forge/addon/args.go
index 038e8b0e0..c0ef43d46 100644
--- a/server/forge/addon/args.go
+++ b/server/forge/addon/args.go
@@ -90,7 +90,7 @@ type httpRequest struct {
Body []byte `json:"body"`
}
-// modelUser is an extension of model.User to marshal all fields to JSON
+// modelUser is an extension of model.User to marshal all fields to JSON.
type modelUser struct {
User *model.User `json:"user"`
@@ -129,7 +129,7 @@ func modelUserFromModel(u *model.User) *modelUser {
}
}
-// modelRepo is an extension of model.Repo to marshal all fields to JSON
+// modelRepo is an extension of model.Repo to marshal all fields to JSON.
type modelRepo struct {
Repo *model.Repo `json:"repo"`
UserID int64 `json:"user_id"`
diff --git a/server/forge/addon/client.go b/server/forge/addon/client.go
index 323b0e8ab..46d600e6e 100644
--- a/server/forge/addon/client.go
+++ b/server/forge/addon/client.go
@@ -30,7 +30,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/server/model"
)
-// make sure RPC implements forge.Forge
+// make sure RPC implements forge.Forge.
var _ forge.Forge = new(RPC)
func Load(file string) (forge.Forge, error) {
@@ -44,7 +44,7 @@ func Load(file string) (forge.Forge, error) {
logger: log.With().Str("addon", file).Logger(),
},
})
- // TODO defer client.Kill()
+ // TODO: defer client.Kill()
rpcClient, err := client.Client()
if err != nil {
diff --git a/server/forge/bitbucket/bitbucket.go b/server/forge/bitbucket/bitbucket.go
index d3c96920e..02e2f1c86 100644
--- a/server/forge/bitbucket/bitbucket.go
+++ b/server/forge/bitbucket/bitbucket.go
@@ -42,7 +42,7 @@ const (
pageSize = 100
)
-// Opts are forge options for bitbucket
+// Opts are forge options for bitbucket.
type Opts struct {
Client string
Secret string
@@ -67,12 +67,12 @@ func New(opts *Opts) (forge.Forge, error) {
// TODO: add checks
}
-// Name returns the string name of this driver
+// Name returns the string name of this driver.
func (c *config) Name() string {
return "bitbucket"
}
-// URL returns the root url of a configured forge
+// URL returns the root url of a configured forge.
func (c *config) URL() string {
return c.url
}
@@ -244,7 +244,7 @@ func (c *config) File(ctx context.Context, u *model.User, r *model.Repo, p *mode
return []byte(*config), nil
}
-// Dir fetches a folder from the bitbucket repository
+// Dir fetches a folder from the bitbucket repository.
func (c *config) Dir(ctx context.Context, u *model.User, r *model.Repo, p *model.Pipeline, f string) ([]*forge_types.FileMeta, error) {
var page *string
repoPathFiles := []*forge_types.FileMeta{}
@@ -375,7 +375,7 @@ func (c *config) Branches(ctx context.Context, u *model.User, r *model.Repo, p *
return branches, nil
}
-// BranchHead returns the sha of the head (latest commit) of the specified branch
+// BranchHead returns the sha of the head (latest commit) of the specified branch.
func (c *config) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (*model.Commit, error) {
commit, err := c.newClient(ctx, u).GetBranchHead(r.Owner, r.Name, branch)
if err != nil {
@@ -432,7 +432,7 @@ func (c *config) Org(ctx context.Context, u *model.User, owner string) (*model.O
}, nil
}
-// helper function to return the bitbucket oauth2 client
+// helper function to return the bitbucket oauth2 client.
func (c *config) newClient(ctx context.Context, u *model.User) *internal.Client {
if u == nil {
return c.newClientToken(ctx, "", "")
@@ -440,7 +440,7 @@ func (c *config) newClient(ctx context.Context, u *model.User) *internal.Client
return c.newClientToken(ctx, u.Token, u.Secret)
}
-// helper function to return the bitbucket oauth2 client
+// helper function to return the bitbucket oauth2 client.
func (c *config) newClientToken(ctx context.Context, token, secret string) *internal.Client {
return internal.NewClientToken(
ctx,
@@ -454,7 +454,7 @@ func (c *config) newClientToken(ctx context.Context, token, secret string) *inte
)
}
-// helper function to return the bitbucket oauth2 config
+// helper function to return the bitbucket oauth2 config.
func (c *config) newOAuth2Config() *oauth2.Config {
return &oauth2.Config{
ClientID: c.Client,
diff --git a/server/forge/bitbucket/convert.go b/server/forge/bitbucket/convert.go
index f6eb69ef1..e9faee70f 100644
--- a/server/forge/bitbucket/convert.go
+++ b/server/forge/bitbucket/convert.go
@@ -213,10 +213,10 @@ func convertPushHook(hook *internal.PushHook, change *internal.Change) *model.Pi
return pipeline
}
-// regex for git author fields ("name ")
+// regex for git author fields (r.g. "name ").
var reGitMail = regexp.MustCompile("<(.*)>")
-// extracts the email from a git commit author string
+// extracts the email from a git commit author string.
func extractEmail(gitauthor string) (author string) {
matches := reGitMail.FindAllStringSubmatch(gitauthor, -1)
if len(matches) == 1 {
diff --git a/server/forge/bitbucketdatacenter/bitbucketdatacenter.go b/server/forge/bitbucketdatacenter/bitbucketdatacenter.go
index 58b0c6d37..126a5d6b6 100644
--- a/server/forge/bitbucketdatacenter/bitbucketdatacenter.go
+++ b/server/forge/bitbucketdatacenter/bitbucketdatacenter.go
@@ -80,12 +80,12 @@ func New(opts Opts) (forge.Forge, error) {
return config, nil
}
-// Name returns the string name of this driver
+// Name returns the string name of this driver.
func (c *client) Name() string {
return "bitbucket_dc"
}
-// URL returns the root url of a configured forge
+// URL returns the root url of a configured forge.
func (c *client) URL() string {
return c.url
}
diff --git a/server/forge/bitbucketdatacenter/internal/client.go b/server/forge/bitbucketdatacenter/internal/client.go
index a712ff2cb..f989f13bc 100644
--- a/server/forge/bitbucketdatacenter/internal/client.go
+++ b/server/forge/bitbucketdatacenter/internal/client.go
@@ -40,7 +40,7 @@ func NewClientWithToken(ctx context.Context, ts oauth2.TokenSource, url string)
}
}
-// FindCurrentUser is returning the current user id - however it is not really part of the API so it is not part of the Bitbucket go client
+// FindCurrentUser is returning the current user id - however it is not really part of the API so it is not part of the Bitbucket go client.
func (c *Client) FindCurrentUser(ctx context.Context) (string, error) {
url := fmt.Sprintf(currentUserID, c.base)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
diff --git a/server/forge/gitea/fixtures/hooks.go b/server/forge/gitea/fixtures/hooks.go
index c98ac226c..2b151a62c 100644
--- a/server/forge/gitea/fixtures/hooks.go
+++ b/server/forge/gitea/fixtures/hooks.go
@@ -14,7 +14,7 @@
package fixtures
-// HookPush is a sample Gitea push hook
+// HookPush is a sample Gitea push hook.
const HookPush = `
{
"ref": "refs/heads/main",
@@ -75,7 +75,7 @@ const HookPush = `
}
`
-// HookPushMulti push multible commits to a branch
+// HookPushMulti push multible commits to a branch.
const HookPushMulti = `
{
"ref": "refs/heads/main",
@@ -272,7 +272,7 @@ const HookPushMulti = `
}
`
-// HookPushBranch is a sample Gitea push hook where a new branch was created from an existing commit
+// HookPushBranch is a sample Gitea push hook where a new branch was created from an existing commit.
const HookPushBranch = `
{
"ref": "refs/heads/fdsafdsa",
@@ -425,7 +425,7 @@ const HookPushBranch = `
}
}`
-// HookTag is a sample Gitea tag hook
+// HookTag is a sample Gitea tag hook.
const HookTag = `{
"sha": "ef98532add3b2feb7a137426bba1248724367df5",
"secret": "l26Un7G7HXogLAvsyf2hOA4EMARSTsR3",
@@ -468,7 +468,7 @@ const HookTag = `{
}
}`
-// HookPullRequest is a sample pull_request webhook payload
+// HookPullRequest is a sample pull_request webhook payload.
const HookPullRequest = `{
"action": "opened",
"number": 1,
diff --git a/server/forge/gitea/gitea.go b/server/forge/gitea/gitea.go
index 964acb1cb..c16463d81 100644
--- a/server/forge/gitea/gitea.go
+++ b/server/forge/gitea/gitea.go
@@ -13,8 +13,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-// This file has been modified by Informatyka Boguslawski sp. z o.o. sp.k.
package gitea
@@ -84,12 +82,12 @@ func New(opts Opts) (forge.Forge, error) {
}, nil
}
-// Name returns the string name of this driver
+// Name returns the string name of this driver.
func (c *Gitea) Name() string {
return "gitea"
}
-// URL returns the root url of a configured forge
+// URL returns the root url of a configured forge.
func (c *Gitea) URL() string {
return c.url
}
@@ -458,7 +456,7 @@ func (c *Gitea) Branches(ctx context.Context, u *model.User, r *model.Repo, p *m
return result, err
}
-// BranchHead returns the sha of the head (latest commit) of the specified branch
+// BranchHead returns the sha of the head (latest commit) of the specified branch.
func (c *Gitea) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (*model.Commit, error) {
token := common.UserToken(ctx, r, u)
client, err := c.newClientToken(ctx, token)
@@ -585,7 +583,7 @@ func (c *Gitea) Org(ctx context.Context, u *model.User, owner string) (*model.Or
}, nil
}
-// helper function to return the Gitea client with Token
+// newClientToken returns the Gitea client with Token.
func (c *Gitea) newClientToken(ctx context.Context, token string) (*gitea.Client, error) {
httpClient := &http.Client{}
if c.SkipVerify {
diff --git a/server/forge/gitea/helper.go b/server/forge/gitea/helper.go
index 51dbde462..6ac89bf34 100644
--- a/server/forge/gitea/helper.go
+++ b/server/forge/gitea/helper.go
@@ -29,7 +29,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/shared/utils"
)
-// helper function that converts a Gitea repository to a Woodpecker repository.
+// toRepo converts a Gitea repository to a Woodpecker repository.
func toRepo(from *gitea.Repository) *model.Repo {
name := strings.Split(from.FullName, "/")[1]
avatar := expandAvatar(
@@ -53,7 +53,7 @@ func toRepo(from *gitea.Repository) *model.Repo {
}
}
-// helper function that converts a Gitea permission to a Woodpecker permission.
+// toPerm converts a Gitea permission to a Woodpecker permission.
func toPerm(from *gitea.Permission) *model.Perm {
return &model.Perm{
Pull: from.Pull,
@@ -62,7 +62,7 @@ func toPerm(from *gitea.Permission) *model.Perm {
}
}
-// helper function that converts a Gitea team to a Woodpecker team.
+// toTeam converts a Gitea team to a Woodpecker team.
func toTeam(from *gitea.Organization, link string) *model.Team {
return &model.Team{
Login: from.UserName,
@@ -70,7 +70,7 @@ func toTeam(from *gitea.Organization, link string) *model.Team {
}
}
-// helper function that extracts the Pipeline data from a Gitea push hook
+// pipelineFromPush extracts the Pipeline data from a Gitea push hook.
func pipelineFromPush(hook *pushHook) *model.Pipeline {
avatar := expandAvatar(
hook.Repo.HTMLURL,
@@ -121,7 +121,7 @@ func getChangedFilesFromPushHook(hook *pushHook) []string {
return utils.DeduplicateStrings(files)
}
-// helper function that extracts the Pipeline data from a Gitea tag hook
+// pipelineFromTag extracts the Pipeline data from a Gitea tag hook.
func pipelineFromTag(hook *pushHook) *model.Pipeline {
avatar := expandAvatar(
hook.Repo.HTMLURL,
@@ -143,7 +143,7 @@ func pipelineFromTag(hook *pushHook) *model.Pipeline {
}
}
-// helper function that extracts the Pipeline data from a Gitea pull_request hook
+// pipelineFromPullRequest extracts the Pipeline data from a Gitea pull_request hook.
func pipelineFromPullRequest(hook *pullRequestHook) *model.Pipeline {
avatar := expandAvatar(
hook.Repo.HTMLURL,
@@ -197,7 +197,7 @@ func pipelineFromRelease(hook *releaseHook) *model.Pipeline {
}
}
-// helper function that parses a push hook from a read closer.
+// parsePush parses a push hook from a read closer.
func parsePush(r io.Reader) (*pushHook, error) {
push := new(pushHook)
err := json.NewDecoder(r).Decode(push)
@@ -216,8 +216,7 @@ func parseRelease(r io.Reader) (*releaseHook, error) {
return pr, err
}
-// fixMalformedAvatar is a helper function that fixes an avatar url if malformed
-// (currently a known bug with gitea)
+// fixMalformedAvatar fixes an avatar url if malformed (currently a known bug with gitea).
func fixMalformedAvatar(url string) string {
index := strings.Index(url, "///")
if index != -1 {
@@ -230,8 +229,7 @@ func fixMalformedAvatar(url string) string {
return url
}
-// expandAvatar is a helper function that converts a relative avatar URL to the
-// absolute url.
+// expandAvatar converts a relative avatar URL to the absolute url.
func expandAvatar(repo, rawurl string) string {
aurl, err := url.Parse(rawurl)
if err != nil {
@@ -252,7 +250,7 @@ func expandAvatar(repo, rawurl string) string {
return aurl.String()
}
-// helper function to return matching hooks.
+// matchingHooks return matching hooks.
func matchingHooks(hooks []*gitea.Hook, rawurl string) *gitea.Hook {
link, err := url.Parse(rawurl)
if err != nil {
diff --git a/server/forge/gitea/parse.go b/server/forge/gitea/parse.go
index 1fb8dacc6..a8856a611 100644
--- a/server/forge/gitea/parse.go
+++ b/server/forge/gitea/parse.go
@@ -72,7 +72,7 @@ func parsePushHook(payload io.Reader) (repo *model.Repo, pipeline *model.Pipelin
return nil, nil, nil
}
- // TODO is this even needed?
+ // TODO: is this even needed?
if push.RefType == refBranch {
return nil, nil, nil
}
diff --git a/server/forge/github/github.go b/server/forge/github/github.go
index 3e0ae25dc..42bb74a17 100644
--- a/server/forge/github/github.go
+++ b/server/forge/github/github.go
@@ -84,12 +84,12 @@ type client struct {
OnlyPublic bool
}
-// Name returns the string name of this driver
+// Name returns the string name of this driver.
func (c *client) Name() string {
return "github"
}
-// URL returns the root url of a configured forge
+// URL returns the root url of a configured forge.
func (c *client) URL() string {
return c.url
}
@@ -390,7 +390,7 @@ func (c *client) Org(ctx context.Context, u *model.User, owner string) (*model.O
}, nil
}
-// helper function to return the GitHub oauth2 context using an HTTPClient that
+// newContext returns the GitHub oauth2 context using an HTTPClient that
// disables TLS verification if disabled in the forge settings.
func (c *client) newContext(ctx context.Context) context.Context {
if !c.SkipVerify {
@@ -406,7 +406,7 @@ func (c *client) newContext(ctx context.Context) context.Context {
})
}
-// helper function to return the GitHub oauth2 config
+// newConfig returns the GitHub oauth2 config.
func (c *client) newConfig() *oauth2.Config {
scopes := []string{"user:email", "read:org"}
if c.OnlyPublic {
@@ -427,7 +427,7 @@ func (c *client) newConfig() *oauth2.Config {
}
}
-// helper function to return the GitHub oauth2 client
+// newClientToken returns the GitHub oauth2 client.
func (c *client) newClientToken(ctx context.Context, token string) *github.Client {
ts := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: token},
@@ -447,7 +447,7 @@ func (c *client) newClientToken(ctx context.Context, token string) *github.Clien
return client
}
-// helper function to return matching user email.
+// matchingEmail returns matching user email.
func matchingEmail(emails []*github.UserEmail, rawURL string) *github.UserEmail {
for _, email := range emails {
if email.Email == nil || email.Primary == nil || email.Verified == nil {
@@ -465,7 +465,7 @@ func matchingEmail(emails []*github.UserEmail, rawURL string) *github.UserEmail
return nil
}
-// helper function to return matching hook.
+// matchingHooks returns matching hook.
func matchingHooks(hooks []*github.Hook, rawurl string) *github.Hook {
link, err := url.Parse(rawurl)
if err != nil {
@@ -493,7 +493,7 @@ func (c *client) Status(ctx context.Context, user *model.User, repo *model.Repo,
if pipeline.Event == model.EventDeploy {
// Get id from url. If not found, skip.
matches := reDeploy.FindStringSubmatch(pipeline.ForgeURL)
- //nolint:gomnd
+ //nolint:mnd
if len(matches) != 2 {
return nil
}
@@ -558,7 +558,7 @@ func (c *client) Branches(ctx context.Context, u *model.User, r *model.Repo, p *
return branches, nil
}
-// BranchHead returns the sha of the head (latest commit) of the specified branch
+// BranchHead returns the sha of the head (latest commit) of the specified branch.
func (c *client) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (*model.Commit, error) {
token := common.UserToken(ctx, r, u)
b, _, err := c.newClientToken(ctx, token).Repositories.GetBranch(ctx, r.Owner, r.Name, branch, 1)
diff --git a/server/forge/gitlab/gitlab.go b/server/forge/gitlab/gitlab.go
index 4f05659a5..2c3c342fc 100644
--- a/server/forge/gitlab/gitlab.go
+++ b/server/forge/gitlab/gitlab.go
@@ -53,7 +53,7 @@ type Opts struct {
SkipVerify bool // Skip ssl verification.
}
-// Gitlab implements "Forge" interface
+// Gitlab implements "Forge" interface.
type GitLab struct {
url string
ClientID string
@@ -75,12 +75,12 @@ func New(opts Opts) (forge.Forge, error) {
}, nil
}
-// Name returns the string name of this driver
+// Name returns the string name of this driver.
func (g *GitLab) Name() string {
return "gitlab"
}
-// URL returns the root url of a configured forge
+// URL returns the root url of a configured forge.
func (g *GitLab) URL() string {
return g.url
}
@@ -176,7 +176,7 @@ func (g *GitLab) Refresh(ctx context.Context, user *model.User) (bool, error) {
return true, nil
}
-// Auth authenticates the session and returns the forge user login for the given token
+// Auth authenticates the session and returns the forge user login for the given token.
func (g *GitLab) Auth(ctx context.Context, token, _ string) (string, error) {
client, err := newClient(g.url, token, g.SkipVerify)
if err != nil {
@@ -381,7 +381,7 @@ func (g *GitLab) File(ctx context.Context, user *model.User, repo *model.Repo, p
return file, err
}
-// Dir fetches a folder from the forge repository
+// Dir fetches a folder from the forge repository.
func (g *GitLab) Dir(ctx context.Context, user *model.User, repo *model.Repo, pipeline *model.Pipeline, path string) ([]*forge_types.FileMeta, error) {
client, err := newClient(g.url, user.Token, g.SkipVerify)
if err != nil {
@@ -605,7 +605,7 @@ func (g *GitLab) Branches(ctx context.Context, user *model.User, repo *model.Rep
return branches, nil
}
-// BranchHead returns the sha of the head (latest commit) of the specified branch
+// BranchHead returns the sha of the head (latest commit) of the specified branch.
func (g *GitLab) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (*model.Commit, error) {
token := common.UserToken(ctx, r, u)
client, err := newClient(g.url, token, g.SkipVerify)
diff --git a/server/forge/types/errors.go b/server/forge/types/errors.go
index 2da1262ae..190f036b2 100644
--- a/server/forge/types/errors.go
+++ b/server/forge/types/errors.go
@@ -40,7 +40,7 @@ func (ae *AuthError) Error() string {
return err
}
-// check interface
+// Check interface implementation at compile time.
var _ error = new(AuthError)
var ErrNotImplemented = errors.New("not implemented")
diff --git a/server/forge/types/meta.go b/server/forge/types/meta.go
index e63d9a8ac..5e1f9652d 100644
--- a/server/forge/types/meta.go
+++ b/server/forge/types/meta.go
@@ -16,7 +16,7 @@ package types
import "sort"
-// FileMeta represents a file in version control
+// FileMeta represents a file in version control.
type FileMeta struct {
Name string
Data []byte
diff --git a/server/grpc/jwt_manager.go b/server/grpc/jwt_manager.go
index 82aa73dda..a02014b8b 100644
--- a/server/grpc/jwt_manager.go
+++ b/server/grpc/jwt_manager.go
@@ -22,13 +22,13 @@ import (
"github.com/golang-jwt/jwt/v5"
)
-// JWTManager is a JSON web token manager
+// JWTManager is a JSON web token manager.
type JWTManager struct {
secretKey string
tokenDuration time.Duration
}
-// UserClaims is a custom JWT claims that contains some user's information
+// UserClaims is a custom JWT claims that contains some user's information.
type AgentTokenClaims struct {
jwt.RegisteredClaims
AgentID int64 `json:"agent_id"`
@@ -36,12 +36,12 @@ type AgentTokenClaims struct {
const jwtTokenDuration = 1 * time.Hour
-// NewJWTManager returns a new JWT manager
+// NewJWTManager returns a new JWT manager.
func NewJWTManager(secretKey string) *JWTManager {
return &JWTManager{secretKey, jwtTokenDuration}
}
-// Generate generates and signs a new token for a user
+// Generate generates and signs a new token for a user.
func (manager *JWTManager) Generate(agentID int64) (string, error) {
claims := AgentTokenClaims{
RegisteredClaims: jwt.RegisteredClaims{
@@ -60,7 +60,7 @@ func (manager *JWTManager) Generate(agentID int64) (string, error) {
return token.SignedString([]byte(manager.secretKey))
}
-// Verify verifies the access token string and return a user claim if the token is valid
+// Verify verifies the access token string and return a user claim if the token is valid.
func (manager *JWTManager) Verify(accessToken string) (*AgentTokenClaims, error) {
token, err := jwt.ParseWithClaims(
accessToken,
diff --git a/server/grpc/rpc.go b/server/grpc/rpc.go
index 59e27885d..013273703 100644
--- a/server/grpc/rpc.go
+++ b/server/grpc/rpc.go
@@ -13,8 +13,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-// This file has been modified by Informatyka Boguslawski sp. z o.o. sp.k.
package grpc
@@ -50,7 +48,7 @@ type RPC struct {
pipelineCount *prometheus.CounterVec
}
-// Next implements the rpc.Next function
+// Next implements the rpc.Next function.
func (s *RPC) Next(c context.Context, agentFilter rpc.Filter) (*rpc.Workflow, error) {
if hostname, err := s.getHostnameFromContext(c); err == nil {
log.Debug().Msgf("agent connected: %s: polling", hostname)
@@ -88,17 +86,17 @@ func (s *RPC) Next(c context.Context, agentFilter rpc.Filter) (*rpc.Workflow, er
}
}
-// Wait implements the rpc.Wait function
+// Wait implements the rpc.Wait function.
func (s *RPC) Wait(c context.Context, id string) error {
return s.queue.Wait(c, id)
}
-// Extend implements the rpc.Extend function
+// Extend implements the rpc.Extend function.
func (s *RPC) Extend(c context.Context, id string) error {
return s.queue.Extend(c, id)
}
-// Update implements the rpc.Update function
+// Update implements the rpc.Update function.
func (s *RPC) Update(_ context.Context, id string, state rpc.State) error {
workflowID, err := strconv.ParseInt(id, 10, 64)
if err != nil {
@@ -164,7 +162,7 @@ func (s *RPC) Update(_ context.Context, id string, state rpc.State) error {
return nil
}
-// Init implements the rpc.Init function
+// Init implements the rpc.Init function.
func (s *RPC) Init(c context.Context, id string, state rpc.State) error {
stepID, err := strconv.ParseInt(id, 10, 64)
if err != nil {
@@ -230,7 +228,7 @@ func (s *RPC) Init(c context.Context, id string, state rpc.State) error {
return nil
}
-// Done implements the rpc.Done function
+// Done implements the rpc.Done function.
func (s *RPC) Done(c context.Context, id string, state rpc.State) error {
workflowID, err := strconv.ParseInt(id, 10, 64)
if err != nil {
@@ -319,7 +317,7 @@ func (s *RPC) Done(c context.Context, id string, state rpc.State) error {
return nil
}
-// Log implements the rpc.Log function
+// Log implements the rpc.Log function.
func (s *RPC) Log(c context.Context, _logEntry *rpc.LogEntry) error {
// convert rpc log_entry to model.log_entry
step, err := s.store.StepByUUID(_logEntry.StepUUID)
diff --git a/server/logging/log.go b/server/logging/log.go
index 942902c84..1db5475e5 100644
--- a/server/logging/log.go
+++ b/server/logging/log.go
@@ -21,15 +21,17 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/server/model"
)
-// TODO (bradrydzewski) writing to subscribers is currently a blocking
+// TODO: (bradrydzewski) writing to subscribers is currently a blocking
// operation and does not protect against slow clients from locking
// the stream. This should be resolved.
-// TODO (bradrydzewski) implement a mux.Info to fetch information and
+//nolint:godot
+// TODO: (bradrydzewski) implement a mux.Info to fetch information and
// statistics for the multiplexer. Streams, subscribers, etc
// mux.Info()
-// TODO (bradrydzewski) refactor code to place publisher and subscriber
+//nolint:godot
+// TODO: (bradrydzewski) refactor code to place publisher and subscriber
// operations in separate files with more encapsulated logic.
// sub.push()
// sub.join()
diff --git a/server/model/agent.go b/server/model/agent.go
index c268644c1..aebb9d742 100644
--- a/server/model/agent.go
+++ b/server/model/agent.go
@@ -29,7 +29,7 @@ type Agent struct {
NoSchedule bool `json:"no_schedule" xorm:"no_schedule"`
} // @name Agent
-// TableName return database table name for xorm
+// TableName return database table name for xorm.
func (Agent) TableName() string {
return "agents"
}
diff --git a/server/model/config.go b/server/model/config.go
index c4322bc35..ee8cd479e 100644
--- a/server/model/config.go
+++ b/server/model/config.go
@@ -24,7 +24,7 @@ type Config struct {
Data []byte `json:"data" xorm:"LONGBLOB 'config_data'"`
} // @name Config
-// PipelineConfig is the n:n relation between Pipeline and Config
+// PipelineConfig is the n:n relation between Pipeline and Config.
type PipelineConfig struct {
ConfigID int64 `json:"-" xorm:"UNIQUE(s) NOT NULL 'config_id'"`
PipelineID int64 `json:"-" xorm:"UNIQUE(s) NOT NULL 'pipeline_id'"`
diff --git a/server/model/const.go b/server/model/const.go
index 152956c6c..0707473b8 100644
--- a/server/model/const.go
+++ b/server/model/const.go
@@ -50,7 +50,7 @@ func (s WebhookEvent) Validate() error {
}
}
-// StatusValue represent pipeline states woodpecker know
+// StatusValue represent pipeline states woodpecker know.
type StatusValue string // @name StatusValue
const (
@@ -66,7 +66,7 @@ const (
StatusCreated StatusValue = "created" // created / internal use only
)
-// SCMKind represent different version control systems
+// SCMKind represent different version control systems.
type SCMKind string // @name SCMKind
const (
@@ -76,7 +76,7 @@ const (
RepoPerforce SCMKind = "perforce"
)
-// RepoVisibility represent to what state a repo in woodpecker is visible to others
+// RepoVisibility represent to what state a repo in woodpecker is visible to others.
type RepoVisibility string // @name RepoVisibility
const (
diff --git a/server/model/cron.go b/server/model/cron.go
index 50e9a8b83..6fa213724 100644
--- a/server/model/cron.go
+++ b/server/model/cron.go
@@ -31,12 +31,12 @@ type Cron struct {
Branch string `json:"branch"`
} // @name Cron
-// TableName returns the database table name for xorm
+// TableName returns the database table name for xorm.
func (Cron) TableName() string {
return "crons"
}
-// Validate a cron
+// Validate ensures cron has a valid name and schedule.
func (c *Cron) Validate() error {
if c.Name == "" {
return fmt.Errorf("name is required")
diff --git a/server/model/org.go b/server/model/org.go
index 0cf2ae3d0..ce432a330 100644
--- a/server/model/org.go
+++ b/server/model/org.go
@@ -24,7 +24,7 @@ type Org struct {
Private bool `json:"-" xorm:"private"`
} // @name Org
-// TableName return database table name for xorm
+// TableName return database table name for xorm.
func (Org) TableName() string {
return "orgs"
}
diff --git a/server/model/perm.go b/server/model/perm.go
index 77fbcc7f5..d0e7c4339 100644
--- a/server/model/perm.go
+++ b/server/model/perm.go
@@ -28,7 +28,7 @@ type Perm struct {
Updated int64 `json:"updated" xorm:"updated"`
} // @name Perm
-// TableName return database table name for xorm
+// TableName return database table name for xorm.
func (Perm) TableName() string {
return "perms"
}
diff --git a/server/model/pipeline.go b/server/model/pipeline.go
index 5d9606792..f2a4557ee 100644
--- a/server/model/pipeline.go
+++ b/server/model/pipeline.go
@@ -59,12 +59,12 @@ type PipelineFilter struct {
After int64
}
-// TableName return database table name for xorm
+// TableName return database table name for xorm.
func (Pipeline) TableName() string {
return "pipelines"
}
-// IsMultiPipeline checks if step list contain more than one parent step
+// IsMultiPipeline checks if step list contain more than one parent step.
func (p Pipeline) IsMultiPipeline() bool {
return len(p.Workflows) > 1
}
diff --git a/server/model/repo.go b/server/model/repo.go
index a2f7fca4f..b1e8b19e8 100644
--- a/server/model/repo.go
+++ b/server/model/repo.go
@@ -53,7 +53,7 @@ type Repo struct {
NetrcOnlyTrusted bool `json:"netrc_only_trusted" xorm:"NOT NULL DEFAULT true 'netrc_only_trusted'"`
} // @name Repo
-// TableName return database table name for xorm
+// TableName return database table name for xorm.
func (Repo) TableName() string {
return "repos"
}
diff --git a/server/model/resource_limit.go b/server/model/resource_limit.go
index ef1847870..90a302993 100644
--- a/server/model/resource_limit.go
+++ b/server/model/resource_limit.go
@@ -14,7 +14,7 @@
package model
-// ResourceLimit is the resource limit to set on pipeline steps
+// ResourceLimit is the resource limit to set on pipeline steps.
type ResourceLimit struct {
MemSwapLimit int64
MemLimit int64
diff --git a/server/model/secret.go b/server/model/secret.go
index cde0f49b4..327da66b0 100644
--- a/server/model/secret.go
+++ b/server/model/secret.go
@@ -54,12 +54,12 @@ type Secret struct {
Events []WebhookEvent `json:"events" xorm:"json 'secret_events'"`
} // @name Secret
-// TableName return database table name for xorm
+// TableName return database table name for xorm.
func (Secret) TableName() string {
return "secrets"
}
-// BeforeInsert will sort events before inserted into database
+// BeforeInsert will sort events before inserted into database.
func (s *Secret) BeforeInsert() {
s.Events = sortEvents(s.Events)
}
diff --git a/server/model/step.go b/server/model/step.go
index 0b93159d6..7ceb81300 100644
--- a/server/model/step.go
+++ b/server/model/step.go
@@ -15,11 +15,13 @@
package model
-// Different ways to handle failure states
+// Different ways to handle failure states.
const (
FailureIgnore = "ignore"
FailureFail = "fail"
- // FailureCancel = "cancel" // Not implemented yet
+ //nolint:godot
+ // TODO: Not implemented yet.
+ // FailureCancel = "cancel"
)
// Step represents a process in the pipeline.
@@ -39,7 +41,7 @@ type Step struct {
Type StepType `json:"type,omitempty" xorm:"step_type"`
} // @name Step
-// TableName return database table name for xorm
+// TableName return database table name for xorm.
func (Step) TableName() string {
return "steps"
}
@@ -54,7 +56,7 @@ func (p *Step) Failing() bool {
return p.Failure == FailureFail && (p.State == StatusError || p.State == StatusKilled || p.State == StatusFailure)
}
-// StepType identifies the type of step
+// StepType identifies the type of step.
type StepType string // @name StepType
const (
diff --git a/server/model/task.go b/server/model/task.go
index b30f1d0f3..c9b5a7801 100644
--- a/server/model/task.go
+++ b/server/model/task.go
@@ -30,7 +30,7 @@ type Task struct {
AgentID int64 `json:"agent_id" xorm:"'agent_id'"`
} // @name Task
-// TableName return database table name for xorm
+// TableName return database table name for xorm.
func (Task) TableName() string {
return "tasks"
}
@@ -41,7 +41,7 @@ func (t *Task) String() string {
return sb.String()
}
-// ShouldRun tells if a task should be run or skipped, based on dependencies
+// ShouldRun tells if a task should be run or skipped, based on dependencies.
func (t *Task) ShouldRun() bool {
if t.runsOnFailure() && t.runsOnSuccess() {
return true
diff --git a/server/model/user.go b/server/model/user.go
index 578d6caf2..66371f772 100644
--- a/server/model/user.go
+++ b/server/model/user.go
@@ -20,7 +20,7 @@ import (
"regexp"
)
-// validate a username (e.g. from github)
+// Validate a username (e.g. from github).
var reUsername = regexp.MustCompile("^[a-zA-Z0-9-_.]+$")
var errUserLoginInvalid = errors.New("invalid user login")
@@ -73,7 +73,7 @@ type User struct {
OrgID int64 `json:"org_id" xorm:"user_org_id"`
} // @name User
-// TableName return database table name for xorm
+// TableName return database table name for xorm.
func (User) TableName() string {
return "users"
}
diff --git a/server/model/workflow.go b/server/model/workflow.go
index b1d6ad54c..e75b4385a 100644
--- a/server/model/workflow.go
+++ b/server/model/workflow.go
@@ -32,7 +32,7 @@ type Workflow struct {
Children []*Step `json:"children,omitempty" xorm:"-"`
}
-// TableName return database table name for xorm
+// TableName return database table name for xorm.
func (Workflow) TableName() string {
return "workflows"
}
@@ -47,7 +47,7 @@ func (p *Workflow) Failing() bool {
return p.State == StatusError || p.State == StatusKilled || p.State == StatusFailure
}
-// IsThereRunningStage determine if it contains workflows running or pending to run
+// IsThereRunningStage determine if it contains workflows running or pending to run.
// TODO: return false based on depends_on (https://github.com/woodpecker-ci/woodpecker/pull/730#discussion_r795681697)
func IsThereRunningStage(workflows []*Workflow) bool {
for _, p := range workflows {
@@ -58,7 +58,7 @@ func IsThereRunningStage(workflows []*Workflow) bool {
return false
}
-// PipelineStatus determine pipeline status based on corresponding workflow list
+// PipelineStatus determine pipeline status based on corresponding workflow list.
func PipelineStatus(workflows []*Workflow) StatusValue {
status := StatusSuccess
@@ -71,7 +71,7 @@ func PipelineStatus(workflows []*Workflow) StatusValue {
return status
}
-// WorkflowStatus determine workflow status based on corresponding step list
+// WorkflowStatus determine workflow status based on corresponding step list.
func WorkflowStatus(steps []*Step) StatusValue {
status := StatusSuccess
diff --git a/server/pipeline/approve.go b/server/pipeline/approve.go
index 22d8a8fa4..374693a2c 100644
--- a/server/pipeline/approve.go
+++ b/server/pipeline/approve.go
@@ -27,7 +27,7 @@ import (
)
// Approve update the status to pending for a blocked pipeline because of a gated repo
-// and start them afterward
+// and start them afterward.
func Approve(ctx context.Context, store store.Store, currentPipeline *model.Pipeline, user *model.User, repo *model.Repo) (*model.Pipeline, error) {
if currentPipeline.Status != model.StatusBlocked {
return nil, ErrBadRequest{Msg: fmt.Sprintf("cannot approve a pipeline with status %s", currentPipeline.Status)}
diff --git a/server/pipeline/create.go b/server/pipeline/create.go
index d2435959c..127c3aa44 100644
--- a/server/pipeline/create.go
+++ b/server/pipeline/create.go
@@ -32,7 +32,7 @@ import (
var skipPipelineRegex = regexp.MustCompile(`\[(?i:ci *skip|skip *ci)\]`)
-// Create a new pipeline and start it
+// Create a new pipeline and start it.
func Create(ctx context.Context, _store store.Store, repo *model.Repo, pipeline *model.Pipeline) (*model.Pipeline, error) {
repoUser, err := _store.GetUser(repo.UserID)
if err != nil {
diff --git a/server/pipeline/decline.go b/server/pipeline/decline.go
index cf8dd0e9a..1f9611c5c 100644
--- a/server/pipeline/decline.go
+++ b/server/pipeline/decline.go
@@ -25,7 +25,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/server/store"
)
-// Decline updates the status to declined for blocked pipelines because of a gated repo
+// Decline updates the status to declined for blocked pipelines because of a gated repo.
func Decline(ctx context.Context, store store.Store, pipeline *model.Pipeline, user *model.User, repo *model.Repo) (*model.Pipeline, error) {
forge, err := server.Config.Services.Manager.ForgeFromRepo(repo)
if err != nil {
diff --git a/server/pipeline/items.go b/server/pipeline/items.go
index 737f2fc43..47cc49a13 100644
--- a/server/pipeline/items.go
+++ b/server/pipeline/items.go
@@ -117,7 +117,7 @@ func createPipelineItems(c context.Context, forge forge.Forge, store store.Store
// setPipelineStepsOnPipeline is the link between pipeline representation in "pipeline package" and server
// to be specific this func currently is used to convert the pipeline.Item list (crafted by StepBuilder.Build()) into
-// a pipeline that can be stored in the database by the server
+// a pipeline that can be stored in the database by the server.
func setPipelineStepsOnPipeline(pipeline *model.Pipeline, pipelineItems []*stepbuilder.Item) *model.Pipeline {
var pidSequence int
for _, item := range pipelineItems {
diff --git a/server/pipeline/restart.go b/server/pipeline/restart.go
index cb5f38c5d..21887cde5 100644
--- a/server/pipeline/restart.go
+++ b/server/pipeline/restart.go
@@ -27,7 +27,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/server/store"
)
-// Restart a pipeline by creating a new one out of the old and start it
+// Restart a pipeline by creating a new one out of the old and start it.
func Restart(ctx context.Context, store store.Store, lastPipeline *model.Pipeline, user *model.User, repo *model.Repo, envs map[string]string) (*model.Pipeline, error) {
forge, err := server.Config.Services.Manager.ForgeFromRepo(repo)
if err != nil {
diff --git a/server/pipeline/start.go b/server/pipeline/start.go
index f136fea29..ae4a24a62 100644
--- a/server/pipeline/start.go
+++ b/server/pipeline/start.go
@@ -25,7 +25,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/server/store"
)
-// start a pipeline, make sure it was stored persistent in the store before
+// start a pipeline, make sure it was stored persistent in the store before.
func start(ctx context.Context, forge forge.Forge, store store.Store, activePipeline *model.Pipeline, user *model.User, repo *model.Repo, pipelineItems []*stepbuilder.Item) (*model.Pipeline, error) {
// call to cancel previous pipelines if needed
if err := cancelPreviousPipelines(ctx, forge, store, activePipeline, repo, user); err != nil {
diff --git a/server/pipeline/stepbuilder/stepBuilder.go b/server/pipeline/stepbuilder/stepBuilder.go
index 0bff2050c..586fad595 100644
--- a/server/pipeline/stepbuilder/stepBuilder.go
+++ b/server/pipeline/stepbuilder/stepBuilder.go
@@ -38,7 +38,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/server/model"
)
-// StepBuilder Takes the hook data and the yaml and returns in internal data model
+// StepBuilder Takes the hook data and the yaml and returns in internal data model.
type StepBuilder struct {
Repo *model.Repo
Curr *model.Pipeline
diff --git a/server/pipeline/topic.go b/server/pipeline/topic.go
index e5ca4d4c6..26c9f432b 100644
--- a/server/pipeline/topic.go
+++ b/server/pipeline/topic.go
@@ -25,7 +25,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/server/pubsub"
)
-// publishToTopic publishes message to UI clients
+// publishToTopic publishes message to UI clients.
func publishToTopic(pipeline *model.Pipeline, repo *model.Repo) {
message := pubsub.Message{
Labels: map[string]string{
diff --git a/server/queue/fifo.go b/server/queue/fifo.go
index 476df8eba..d6fe664c9 100644
--- a/server/queue/fifo.go
+++ b/server/queue/fifo.go
@@ -53,7 +53,7 @@ type fifo struct {
// New returns a new fifo queue.
//
-//nolint:gomnd
+//nolint:mnd
func New(_ context.Context) Queue {
return &fifo{
workers: map[*worker]struct{}{},
@@ -225,7 +225,7 @@ func (q *fifo) Info(_ context.Context) InfoT {
return stats
}
-// Pause stops the queue from handing out new work items in Poll
+// Pause stops the queue from handing out new work items in Poll.
func (q *fifo) Pause() {
q.Lock()
q.paused = true
diff --git a/server/router/router.go b/server/router/router.go
index d64833c75..0fcf47f46 100644
--- a/server/router/router.go
+++ b/server/router/router.go
@@ -33,7 +33,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/server/web"
)
-// Load loads the router
+// Load loads the router.
func Load(noRouteHandler http.HandlerFunc, middleware ...gin.HandlerFunc) http.Handler {
e := gin.New()
e.UseRawPath = true
diff --git a/server/services/config/forge.go b/server/services/config/forge.go
index a979f5b4d..c88a30ca6 100644
--- a/server/services/config/forge.go
+++ b/server/services/config/forge.go
@@ -77,7 +77,7 @@ type forgeFetcherContext struct {
timeout time.Duration
}
-// fetch config by timeout
+// fetch attempts to fetch the configuration file(s) for the given config string.
func (f *forgeFetcherContext) fetch(c context.Context, config string) ([]*types.FileMeta, error) {
ctx, cancel := context.WithTimeout(c, f.timeout)
defer cancel()
diff --git a/server/services/config/http.go b/server/services/config/http.go
index 3912fdbeb..59e9a4df8 100644
--- a/server/services/config/http.go
+++ b/server/services/config/http.go
@@ -31,7 +31,7 @@ type http struct {
privateKey crypto.PrivateKey
}
-// configData same as forge.FileMeta but with json tags and string data
+// configData same as forge.FileMeta but with json tags and string data.
type configData struct {
Name string `json:"name"`
Data string `json:"data"`
diff --git a/server/services/encryption/constants.go b/server/services/encryption/constants.go
index 90feabd32..0ae7039dd 100644
--- a/server/services/encryption/constants.go
+++ b/server/services/encryption/constants.go
@@ -16,7 +16,7 @@ package encryption
import "errors"
-// common
+// Common.
const (
rawKeyConfigFlag = "encryption-raw-key"
tinkKeysetFilepathConfigFlag = "encryption-tink-keyset"
@@ -39,7 +39,7 @@ var (
)
const (
- // error wrapping templates
+ // Error wrapping templates.
errTemplateFailedInitializingUnencrypted = "failed initializing server in unencrypted mode: %w"
errTemplateFailedInitializing = "failed initializing encryption service: %w"
errTemplateFailedEnablingEncryption = "failed enabling encryption: %w"
@@ -53,13 +53,13 @@ const (
errTemplateBase64DecryptionFailed = "decryption error: Base64 decryption failed. Cause: %w"
errTemplateDecryptionFailed = "decryption error: %w"
- // error messages
+ // Error messages.
errMessageTemplateUnsupportedKeyType = "unsupported encryption key type: %s"
errMessageCantUseBothServices = "cannot use raw encryption key and tink keyset at the same time"
errMessageNoKeysProvided = "encryption enabled but no keys provided"
errMessageFailedRotatingEncryption = "failed rotating encryption"
- // log messages
+ // Log messages.
logMessageEncryptionEnabled = "encryption enabled"
logMessageEncryptionDisabled = "encryption disabled"
logMessageEncryptionKeyRegistered = "registered new encryption key"
@@ -69,9 +69,9 @@ const (
logMessageClientsDecrypted = "disabled encryption on registered service"
)
-// tink
+// Tink.
const (
- // error wrapping templates
+ // Error wrapping templates.
errTemplateTinkFailedLoadingKeyset = "failed loading encryption keyset: %w"
errTemplateTinkFailedValidatingKeyset = "failed validating encryption keyset: %w"
errTemplateTinkFailedInitializeFileWatcher = "failed initializing keyset file watcher: %w"
@@ -80,18 +80,18 @@ const (
errTemplateTinkFailedReadingKeyset = "failed reading encryption keyset from file: %w"
errTemplateTinkFailedInitializingAEAD = "failed initializing AEAD instance: %w"
- // error messages
+ // Error messages.
errMessageTinkKeysetFileWatchFailed = "failed watching encryption keyset file changes"
- // log message templates
+ // Log message templates.
logTemplateTinkKeysetFileChanged = "changes detected in encryption keyset file: '%s'. Encryption service will be reloaded"
logTemplateTinkLoadingKeyset = "loading encryption keyset from file: %s"
logTemplateTinkFailedClosingKeysetFile = "could not close keyset file: %s"
)
-// aes
+// AES.
const (
- // error wrapping templates
+ // Error wrapping templates.
errTemplateAesFailedLoadingCipher = "failed loading encryption cipher: %w"
errTemplateAesFailedCalculatingHash = "failed calculating hash: %w"
errTemplateAesFailedGeneratingKey = "failed generating key from passphrase: %w"
diff --git a/server/services/encryption/tink_keyset_watcher.go b/server/services/encryption/tink_keyset_watcher.go
index 149278d55..8f53bf975 100644
--- a/server/services/encryption/tink_keyset_watcher.go
+++ b/server/services/encryption/tink_keyset_watcher.go
@@ -21,7 +21,7 @@ import (
"github.com/rs/zerolog/log"
)
-// Watch keyset file events to detect key rotations and hot reload keys
+// Watch keyset file events to detect key rotations and hot reload keys.
func (svc *tinkEncryptionService) initFileWatcher() error {
watcher, err := fsnotify.NewWatcher()
if err != nil {
diff --git a/server/services/encryption/types/encryption.go b/server/services/encryption/types/encryption.go
index 2d6b136fb..93aad8e78 100644
--- a/server/services/encryption/types/encryption.go
+++ b/server/services/encryption/types/encryption.go
@@ -14,7 +14,7 @@
package types
-// EncryptionBuilder is user API to obtain correctly configured encryption
+// EncryptionBuilder is user API to obtain correctly configured encryption.
type EncryptionBuilder interface {
WithClient(client EncryptionClient) EncryptionBuilder
Build() error
diff --git a/server/services/encryption/wrapper/store/secret_store_wrapper.go b/server/services/encryption/wrapper/store/secret_store_wrapper.go
index c776bcfa1..e88cc51e3 100644
--- a/server/services/encryption/wrapper/store/secret_store_wrapper.go
+++ b/server/services/encryption/wrapper/store/secret_store_wrapper.go
@@ -30,7 +30,7 @@ type EncryptedSecretStore struct {
encryption types.EncryptionService
}
-// ensure wrapper match interface
+// Ensure wrapper match interface.
var _ model.SecretStore = new(EncryptedSecretStore)
func NewSecretStore(secretStore model.SecretStore) *EncryptedSecretStore {
diff --git a/server/services/registry/filesystem.go b/server/services/registry/filesystem.go
index 6d7006274..c84a0f3e9 100644
--- a/server/services/registry/filesystem.go
+++ b/server/services/registry/filesystem.go
@@ -97,7 +97,7 @@ func (f *filesystem) RegistryList(_ *model.Repo, p *model.ListOptions) ([]*model
return model.ApplyPagination(p, regs), nil
}
-// decodeAuth decodes a base64 encoded string and returns username and password
+// decodeAuth decodes a base64 encoded string and returns username and password.
func decodeAuth(authStr string) (string, string, error) {
if authStr == "" {
return "", "", nil
diff --git a/server/services/setup.go b/server/services/setup.go
index 097a0215c..57dd1f94b 100644
--- a/server/services/setup.go
+++ b/server/services/setup.go
@@ -72,7 +72,7 @@ func setupConfigService(c *cli.Context, privateSignatureKey crypto.PrivateKey) (
return configFetcher, nil
}
-// setupSignatureKeys generate or load key pair to sign webhooks requests (i.e. used for service extensions)
+// setupSignatureKeys generate or load key pair to sign webhooks requests (i.e. used for service extensions).
func setupSignatureKeys(_store store.Store) (crypto.PrivateKey, crypto.PublicKey, error) {
privKeyID := "signature-private-key"
diff --git a/server/store/common.go b/server/store/common.go
index ee919991d..4a051d838 100644
--- a/server/store/common.go
+++ b/server/store/common.go
@@ -19,7 +19,7 @@ type XORM struct {
ShowSQL bool
}
-// Opts are options for a new database connection
+// Opts are options for a new database connection.
type Opts struct {
Driver string
Config string
diff --git a/server/store/datastore/cron.go b/server/store/datastore/cron.go
index c6c7713cb..ce2609269 100644
--- a/server/store/datastore/cron.go
+++ b/server/store/datastore/cron.go
@@ -47,13 +47,13 @@ func (s storage) CronDelete(repo *model.Repo, id int64) error {
return wrapDelete(s.engine.ID(id).Where("repo_id = ?", repo.ID).Delete(new(model.Cron)))
}
-// CronListNextExecute returns limited number of jobs with NextExec being less or equal to the provided unix timestamp
+// CronListNextExecute returns limited number of jobs with NextExec being less or equal to the provided unix timestamp.
func (s storage) CronListNextExecute(nextExec, limit int64) ([]*model.Cron, error) {
crons := make([]*model.Cron, 0, limit)
return crons, s.engine.Where(builder.Lte{"next_exec": nextExec}).Limit(int(limit)).Find(&crons)
}
-// CronGetLock try to get a lock by updating NextExec
+// CronGetLock try to get a lock by updating NextExec.
func (s storage) CronGetLock(cron *model.Cron, newNextExec int64) (bool, error) {
cols, err := s.engine.ID(cron.ID).Where(builder.Eq{"next_exec": cron.NextExec}).
Cols("next_exec").Update(&model.Cron{NextExec: newNextExec})
diff --git a/server/store/datastore/engine.go b/server/store/datastore/engine.go
index 20b1b9b54..bee837a1d 100644
--- a/server/store/datastore/engine.go
+++ b/server/store/datastore/engine.go
@@ -53,7 +53,7 @@ func (s storage) Ping() error {
return s.engine.Ping()
}
-// Migrate old storage or init new one
+// Migrate old storage or init new one.
func (s storage) Migrate(allowLong bool) error {
return migration.Migrate(s.engine, allowLong)
}
diff --git a/server/store/datastore/helper.go b/server/store/datastore/helper.go
index 0b3e5dca1..a883cf516 100644
--- a/server/store/datastore/helper.go
+++ b/server/store/datastore/helper.go
@@ -25,7 +25,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/server/store/types"
)
-// wrapGet return error if err not nil or if requested entry do not exist
+// wrapGet return error if err not nil or if requested entry do not exist.
func wrapGet(exist bool, err error) error {
if !exist {
return types.RecordNotExist
@@ -38,7 +38,7 @@ func wrapGet(exist bool, err error) error {
return nil
}
-// wrapDelete return error if err not nil or if requested entry do not exist
+// wrapDelete return error if err not nil or if requested entry do not exist.
func wrapDelete(c int64, err error) error {
if c == 0 {
return types.RecordNotExist
diff --git a/server/store/datastore/init_cgo.go b/server/store/datastore/init_cgo.go
index 5ddbd71b8..a103b8fa8 100644
--- a/server/store/datastore/init_cgo.go
+++ b/server/store/datastore/init_cgo.go
@@ -18,13 +18,13 @@
package datastore
import (
- // blank imports to register the sql drivers
+ // Blank imports to register the sql drivers.
_ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq"
_ "github.com/mattn/go-sqlite3"
)
-// Supported database drivers
+// Supported database drivers.
const (
DriverSqlite = "sqlite3"
DriverMysql = "mysql"
diff --git a/server/store/datastore/migration/008_secrets_add_user.go b/server/store/datastore/migration/008_secrets_add_user.go
index b77208f75..6755a3b62 100644
--- a/server/store/datastore/migration/008_secrets_add_user.go
+++ b/server/store/datastore/migration/008_secrets_add_user.go
@@ -25,7 +25,7 @@ type SecretV008 struct {
Name string `json:"name" xorm:"NOT NULL UNIQUE(s) INDEX 'secret_name'"`
}
-// TableName return database table name for xorm
+// TableName return database table name for xorm.
func (SecretV008) TableName() string {
return "secrets"
}
diff --git a/server/store/datastore/migration/020_alter_logs_table.go b/server/store/datastore/migration/020_alter_logs_table.go
index e4cca5e8e..33e050f32 100644
--- a/server/store/datastore/migration/020_alter_logs_table.go
+++ b/server/store/datastore/migration/020_alter_logs_table.go
@@ -28,7 +28,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/shared/utils"
)
-// perPage020 sets the size of the slice to read per page
+// perPage020 sets the size of the slice to read per page.
var perPage020 = 100
type oldLogs020 struct {
diff --git a/server/store/datastore/migration/022_add_orgs.go b/server/store/datastore/migration/022_add_orgs.go
index 0d8968903..35064fef6 100644
--- a/server/store/datastore/migration/022_add_orgs.go
+++ b/server/store/datastore/migration/022_add_orgs.go
@@ -41,7 +41,7 @@ type syncRepo022 struct {
OrgID int64 `json:"org_id" xorm:"repo_org_id"`
}
-// TableName return database table name for xorm
+// TableName return database table name for xorm.
func (syncRepo022) TableName() string {
return "repos"
}
@@ -52,7 +52,7 @@ type repo022 struct {
Owner string `json:"owner" xorm:"UNIQUE(name) 'repo_owner'"`
}
-// TableName return database table name for xorm
+// TableName return database table name for xorm.
func (repo022) TableName() string {
return "repos"
}
diff --git a/server/store/datastore/migration/027_convert_to_new_pipeline_errors_format.go b/server/store/datastore/migration/027_convert_to_new_pipeline_errors_format.go
index fa9994294..a51ac1c6a 100644
--- a/server/store/datastore/migration/027_convert_to_new_pipeline_errors_format.go
+++ b/server/store/datastore/migration/027_convert_to_new_pipeline_errors_format.go
@@ -21,7 +21,7 @@ import (
errorTypes "go.woodpecker-ci.org/woodpecker/v2/pipeline/errors/types"
)
-// perPage027 set the size of the slice to read per page
+// perPage027 set the size of the slice to read per page.
var perPage027 = 100
type pipeline027 struct {
diff --git a/server/store/datastore/migration/029_clean_registry_pipeline.go b/server/store/datastore/migration/029_clean_registry_pipeline.go
index 8534369a4..21eb4277b 100644
--- a/server/store/datastore/migration/029_clean_registry_pipeline.go
+++ b/server/store/datastore/migration/029_clean_registry_pipeline.go
@@ -36,7 +36,7 @@ type oldPipeline029 struct {
CloneURL string `json:"clone_url" xorm:"pipeline_clone_url"`
}
-// TableName return database table name for xorm
+// TableName return database table name for xorm.
func (oldPipeline029) TableName() string {
return "pipelines"
}
diff --git a/server/store/datastore/migration/common.go b/server/store/datastore/migration/common.go
index 5bc77db7d..23a51ecd0 100644
--- a/server/store/datastore/migration/common.go
+++ b/server/store/datastore/migration/common.go
@@ -37,7 +37,7 @@ func renameTable(sess *xorm.Session, old, new string) error {
}
}
-// WARNING: YOU MUST COMMIT THE SESSION AT THE END
+// WARNING: YOU MUST COMMIT THE SESSION AT THE END.
func dropTableColumns(sess *xorm.Session, tableName string, columnNames ...string) (err error) {
// Copyright 2017 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
diff --git a/server/store/datastore/migration/migration.go b/server/store/datastore/migration/migration.go
index f2af625a9..ac21feb1c 100644
--- a/server/store/datastore/migration/migration.go
+++ b/server/store/datastore/migration/migration.go
@@ -25,7 +25,7 @@ import (
)
// APPEND NEW MIGRATIONS
-// they are executed in order and if one fails Xormigrate will try to rollback that specific one and quits
+// They are executed in order and if one fails Xormigrate will try to rollback that specific one and quits.
var migrationTasks = []*xormigrate.Migration{
&legacyToXormigrate,
&legacy2Xorm,
diff --git a/server/store/datastore/migration/migration_test.go b/server/store/datastore/migration/migration_test.go
index 073d8c33a..cf4b1a761 100644
--- a/server/store/datastore/migration/migration_test.go
+++ b/server/store/datastore/migration/migration_test.go
@@ -19,7 +19,7 @@ import (
"testing"
"time"
- // blank imports to register the sql drivers
+ // Blank imports to register the sql drivers.
_ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq"
_ "github.com/mattn/go-sqlite3"
diff --git a/server/store/datastore/permission.go b/server/store/datastore/permission.go
index 255ede5ce..16e95edb6 100644
--- a/server/store/datastore/permission.go
+++ b/server/store/datastore/permission.go
@@ -73,7 +73,7 @@ func (s storage) permUpsert(sess *xorm.Session, perm *model.Perm) error {
}
// userPushOrAdminCondition return condition where user must have push or admin rights
-// if used make sure to have permission table ("perms") joined
+// if used make sure to have permission table ("perms") joined.
func userPushOrAdminCondition(userID int64) builder.Cond {
return builder.Eq{"perms.perm_user_id": userID}.
And(builder.Eq{"perms.perm_push": true}.
diff --git a/server/store/datastore/pipeline.go b/server/store/datastore/pipeline.go
index 515d826ff..fc210a43e 100644
--- a/server/store/datastore/pipeline.go
+++ b/server/store/datastore/pipeline.go
@@ -72,7 +72,7 @@ func (s storage) GetPipelineList(repo *model.Repo, p *model.ListOptions, f *mode
Find(&pipelines)
}
-// GetActivePipelineList get all pipelines that are pending, running or blocked
+// GetActivePipelineList get all pipelines that are pending, running or blocked.
func (s storage) GetActivePipelineList(repo *model.Repo) ([]*model.Pipeline, error) {
pipelines := make([]*model.Pipeline, 0)
query := s.engine.
diff --git a/server/store/datastore/repo.go b/server/store/datastore/repo.go
index bb33f15d5..fdc2043fb 100644
--- a/server/store/datastore/repo.go
+++ b/server/store/datastore/repo.go
@@ -159,7 +159,7 @@ func (s storage) RepoList(user *model.User, owned, active bool) ([]*model.Repo,
Find(&repos)
}
-// RepoListAll list all repos
+// RepoListAll list all repos.
func (s storage) RepoListAll(active bool, p *model.ListOptions) ([]*model.Repo, error) {
repos := make([]*model.Repo, 0)
sess := s.paginate(p).Table("repos")
diff --git a/server/store/datastore/workflow.go b/server/store/datastore/workflow.go
index eaa3b8768..b3325b9a0 100644
--- a/server/store/datastore/workflow.go
+++ b/server/store/datastore/workflow.go
@@ -64,7 +64,7 @@ func (s storage) workflowsCreate(sess *xorm.Session, workflows []*model.Workflow
return nil
}
-// WorkflowsReplace performs an atomic replacement of workflows and associated steps by deleting all existing workflows and steps and inserting the new ones
+// WorkflowsReplace performs an atomic replacement of workflows and associated steps by deleting all existing workflows and steps and inserting the new ones.
func (s storage) WorkflowsReplace(pipeline *model.Pipeline, workflows []*model.Workflow) error {
sess := s.engine.NewSession()
defer sess.Close()
@@ -109,7 +109,7 @@ func (s storage) WorkflowList(pipeline *model.Pipeline) ([]*model.Workflow, erro
return s.workflowList(s.engine.NewSession(), pipeline)
}
-// workflowList lists workflows without child steps
+// workflowList lists workflows without child steps.
func (s storage) workflowList(sess *xorm.Session, pipeline *model.Pipeline) ([]*model.Workflow, error) {
var wfList []*model.Workflow
err := sess.Where("workflow_pipeline_id = ?", pipeline.ID).
diff --git a/server/store/datastore/xorm.go b/server/store/datastore/xorm.go
index 70e215fc8..82aa9ecae 100644
--- a/server/store/datastore/xorm.go
+++ b/server/store/datastore/xorm.go
@@ -29,80 +29,80 @@ func newXORMLogger(level xlog.LogLevel) xlog.Logger {
}
}
-// xormLogger custom log implementation for ILogger
+// xormLogger custom log implementation for ILogger.
type xormLogger struct {
logger zerolog.Logger
level xlog.LogLevel
showSQL bool
}
-// Error implement ILogger
+// Error implement ILogger.
func (x *xormLogger) Error(v ...any) {
if x.level <= xlog.LOG_ERR {
x.logger.Error().Msg(fmt.Sprintln(v...))
}
}
-// Errorf implement ILogger
+// Errorf implement ILogger.
func (x *xormLogger) Errorf(format string, v ...any) {
if x.level <= xlog.LOG_ERR {
x.logger.Error().Msg(fmt.Sprintf(format, v...))
}
}
-// Debug implement ILogger
+// Debug implement ILogger.
func (x *xormLogger) Debug(v ...any) {
if x.level <= xlog.LOG_DEBUG {
x.logger.Debug().Msg(fmt.Sprintln(v...))
}
}
-// Debugf implement ILogger
+// Debugf implement ILogger.
func (x *xormLogger) Debugf(format string, v ...any) {
if x.level <= xlog.LOG_DEBUG {
x.logger.Debug().Msg(fmt.Sprintf(format, v...))
}
}
-// Info implement ILogger
+// Info implement ILogger.
func (x *xormLogger) Info(v ...any) {
if x.level <= xlog.LOG_INFO {
x.logger.Info().Msg(fmt.Sprintln(v...))
}
}
-// Infof implement ILogger
+// Infof implement ILogger.
func (x *xormLogger) Infof(format string, v ...any) {
if x.level <= xlog.LOG_INFO {
x.logger.Info().Msg(fmt.Sprintf(format, v...))
}
}
-// Warn implement ILogger
+// Warn implement ILogger.
func (x *xormLogger) Warn(v ...any) {
if x.level <= xlog.LOG_WARNING {
x.logger.Warn().Msg(fmt.Sprintln(v...))
}
}
-// Warnf implement ILogger
+// Warnf implement ILogger.
func (x *xormLogger) Warnf(format string, v ...any) {
if x.level <= xlog.LOG_WARNING {
x.logger.Warn().Msg(fmt.Sprintf(format, v...))
}
}
-// Level implement ILogger
+// Level implement ILogger.
func (x *xormLogger) Level() xlog.LogLevel {
return xlog.LOG_INFO
}
-// SetLevel implement ILogger
+// SetLevel implement ILogger.
func (x *xormLogger) SetLevel(l xlog.LogLevel) {
x.level = l
}
-// ShowSQL implement ILogger
+// ShowSQL implement ILogger.
func (x *xormLogger) ShowSQL(show ...bool) {
if len(show) == 0 {
x.showSQL = true
@@ -111,7 +111,7 @@ func (x *xormLogger) ShowSQL(show ...bool) {
x.showSQL = show[0]
}
-// IsShowSQL implement ILogger
+// IsShowSQL implement ILogger.
func (x *xormLogger) IsShowSQL() bool {
return x.showSQL
}
diff --git a/server/web/web.go b/server/web/web.go
index bf007dca0..f827ab60e 100644
--- a/server/web/web.go
+++ b/server/web/web.go
@@ -127,7 +127,7 @@ func serveFile(f *prefixFS) func(ctx *gin.Context) {
}
}
-// redirect return gin helper to redirect a request
+// redirect return gin helper to redirect a request.
func redirect(location string, status ...int) func(ctx *gin.Context) {
return func(ctx *gin.Context) {
code := http.StatusFound
diff --git a/shared/constant/constant.go b/shared/constant/constant.go
index 723443df2..ca315e987 100644
--- a/shared/constant/constant.go
+++ b/shared/constant/constant.go
@@ -14,7 +14,7 @@
package constant
-// PrivilegedPlugins can be changed by 'WOODPECKER_ESCALATE' at runtime
+// PrivilegedPlugins can be changed by 'WOODPECKER_ESCALATE' at runtime.
var PrivilegedPlugins = []string{
"plugins/docker",
"plugins/gcr",
@@ -24,7 +24,7 @@ var PrivilegedPlugins = []string{
}
// DefaultConfigOrder represent the priority in witch woodpecker search for a pipeline config by default
-// folders are indicated by supplying a trailing /
+// folders are indicated by supplying a trailing slash.
var DefaultConfigOrder = [...]string{
".woodpecker/",
".woodpecker.yaml",
@@ -32,7 +32,7 @@ var DefaultConfigOrder = [...]string{
}
const (
- // DefaultCloneImage can be changed by 'WOODPECKER_DEFAULT_CLONE_IMAGE' at runtime
+ // DefaultCloneImage can be changed by 'WOODPECKER_DEFAULT_CLONE_IMAGE' at runtime.
DefaultCloneImage = "docker.io/woodpeckerci/plugin-git:2.4.0"
)
diff --git a/shared/utils/paginate.go b/shared/utils/paginate.go
index a8b883ff0..b4c280445 100644
--- a/shared/utils/paginate.go
+++ b/shared/utils/paginate.go
@@ -14,7 +14,7 @@
package utils
-// Paginate iterates over a func call until it does not return new items and return it as list
+// Paginate iterates over a func call until it does not return new items and return it as list.
func Paginate[T any](get func(page int) ([]T, error)) ([]T, error) {
items := make([]T, 0, 10)
page := 1
diff --git a/shared/utils/slices.go b/shared/utils/slices.go
index 6f5229a61..5cb95b530 100644
--- a/shared/utils/slices.go
+++ b/shared/utils/slices.go
@@ -32,7 +32,7 @@ func MergeSlices[T any](slices ...[]T) []T {
return result
}
-// EqualSliceValues compare two slices if they have equal values independent of how they are sorted
+// EqualSliceValues compare two slices if they have equal values independent of how they are sorted.
func EqualSliceValues[E comparable](s1, s2 []E) bool {
if len(s1) != len(s2) {
return false
diff --git a/shared/utils/strings.go b/shared/utils/strings.go
index bbbc33c08..251156300 100644
--- a/shared/utils/strings.go
+++ b/shared/utils/strings.go
@@ -14,7 +14,7 @@
package utils
-// DeduplicateStrings deduplicate string list, empty items are dropped
+// DeduplicateStrings deduplicate string list, empty items are dropped.
func DeduplicateStrings(src []string) []string {
m := make(map[string]struct{}, len(src))
dst := make([]string, 0, len(src))
diff --git a/version/version.go b/version/version.go
index a17edc156..67e495188 100644
--- a/version/version.go
+++ b/version/version.go
@@ -16,10 +16,10 @@
package version
-// Version of Woodpecker, set with ldflags, from Git tag
+// Version of Woodpecker, set with ldflags, from Git tag.
var Version string
-// String returns the Version set at build time or "dev"
+// String returns the Version set at build time or "dev".
func String() string {
if Version == "" {
return "dev"
diff --git a/web/src/components/repo/pipeline/PipelineLog.vue b/web/src/components/repo/pipeline/PipelineLog.vue
index 8a505b304..59494b78b 100644
--- a/web/src/components/repo/pipeline/PipelineLog.vue
+++ b/web/src/components/repo/pipeline/PipelineLog.vue
@@ -311,7 +311,7 @@ async function deleteLogs() {
throw new Error('The repository, pipeline or step was undefined');
}
- // TODO use proper dialog (copy-pasted from web/src/components/secrets/SecretList.vue:deleteSecret)
+ // TODO: use proper dialog (copy-pasted from web/src/components/secrets/SecretList.vue:deleteSecret)
// eslint-disable-next-line no-alert, no-restricted-globals
if (!confirm(i18n.t('repo.pipeline.log_delete_confirm'))) {
return;
diff --git a/web/src/components/repo/settings/ActionsTab.vue b/web/src/components/repo/settings/ActionsTab.vue
index 26b586fb1..71ea40915 100644
--- a/web/src/components/repo/settings/ActionsTab.vue
+++ b/web/src/components/repo/settings/ActionsTab.vue
@@ -74,7 +74,7 @@ const { doSubmit: deleteRepo, isLoading: isDeletingRepo } = useAsyncAction(async
throw new Error('Unexpected: Repo should be set');
}
- // TODO use proper dialog
+ // TODO: use proper dialog
// eslint-disable-next-line no-alert, no-restricted-globals
if (!confirm(i18n.t('repo.settings.actions.delete.confirm'))) {
return;
diff --git a/web/src/components/secrets/SecretList.vue b/web/src/components/secrets/SecretList.vue
index 4faea19df..e392ef062 100644
--- a/web/src/components/secrets/SecretList.vue
+++ b/web/src/components/secrets/SecretList.vue
@@ -64,7 +64,7 @@ function editSecret(secret: Secret) {
}
function deleteSecret(secret: Secret) {
- // TODO use proper dialog
+ // TODO: use proper dialog
// eslint-disable-next-line no-alert, no-restricted-globals
if (!confirm(i18n.t('repo.settings.secrets.delete_confirm'))) {
return;
diff --git a/web/src/compositions/usePipeline.ts b/web/src/compositions/usePipeline.ts
index db7d4f736..aba6442c5 100644
--- a/web/src/compositions/usePipeline.ts
+++ b/web/src/compositions/usePipeline.ts
@@ -34,7 +34,7 @@ export default (pipeline: Ref) => {
return null;
}
- // TODO check whether elapsed works
+ // TODO: check whether elapsed works
return timeAgo(sinceElapsed.value);
});
diff --git a/web/src/lib/api/client.ts b/web/src/lib/api/client.ts
index aab22ee55..fa0e9a089 100644
--- a/web/src/lib/api/client.ts
+++ b/web/src/lib/api/client.ts
@@ -101,7 +101,7 @@ export default class ApiClient {
if (!opts.reconnect) {
events.onerror = (err) => {
- // TODO check if such events really have a data property
+ // TODO: check if such events really have a data property
if ((err as Event & { data: string }).data === 'eof') {
events.close();
}
diff --git a/woodpecker-go/woodpecker/client.go b/woodpecker-go/woodpecker/client.go
index f2c385ebe..81d87bc90 100644
--- a/woodpecker-go/woodpecker/client.go
+++ b/woodpecker-go/woodpecker/client.go
@@ -28,6 +28,7 @@ import (
const (
pathLogLevel = "%s/api/log-level"
+ //nolint:godot
// TODO: implement endpoints
// pathFeed = "%s/api/user/feed"
// pathVersion = "%s/version"
@@ -58,7 +59,7 @@ func (c *client) SetAddress(addr string) {
c.addr = addr
}
-// LogLevel returns the current logging level
+// LogLevel returns the current logging level.
func (c *client) LogLevel() (*LogLevel, error) {
out := new(LogLevel)
uri := fmt.Sprintf(pathLogLevel, c.addr)
@@ -66,7 +67,7 @@ func (c *client) LogLevel() (*LogLevel, error) {
return out, err
}
-// SetLogLevel sets the logging level of the server
+// SetLogLevel sets the logging level of the server.
func (c *client) SetLogLevel(in *LogLevel) (*LogLevel, error) {
out := new(LogLevel)
uri := fmt.Sprintf(pathLogLevel, c.addr)
@@ -75,7 +76,7 @@ func (c *client) SetLogLevel(in *LogLevel) (*LogLevel, error) {
}
//
-// http request helper functions
+// HTTP request helper functions.
//
// Helper function for making an http GET request.
@@ -144,7 +145,7 @@ func (c *client) open(rawurl, method string, in any) (io.ReadCloser, error) {
return resp.Body, nil
}
-// mapValues converts a map to url.Values
+// mapValues converts a map to `url.Values`.
func mapValues(params map[string]string) url.Values {
values := url.Values{}
for key, val := range params {
diff --git a/woodpecker-go/woodpecker/types.go b/woodpecker-go/woodpecker/types.go
index f8054e66d..7d2f0d46e 100644
--- a/woodpecker-go/woodpecker/types.go
+++ b/woodpecker-go/woodpecker/types.go
@@ -136,9 +136,9 @@ type (
Username string `json:"username"`
Password string `json:"password,omitempty"`
// Deprecated
- Email string `json:"email"` // TODO remove in 3.x
+ Email string `json:"email"` // TODO: remove in 3.x
// Deprecated
- Token string `json:"token"` // TODO remove in 3.x
+ Token string `json:"token"` // TODO: remove in 3.x
}
// Secret represents a secret variable, such as a password or token.
@@ -181,6 +181,8 @@ type (
Commit string `json:"commit,omitempty"`
}
+ //nolint:godot
+ // TODO: use dedicated struct in 3.x
// QueueStats struct {
// Workers int `json:"worker_count"`
// Pending int `json:"pending_count"`
@@ -194,7 +196,7 @@ type (
Pending []Task `json:"pending"`
WaitingOnDeps []Task `json:"waiting_on_deps"`
Running []Task `json:"running"`
- // TODO use dedicated struct in 3.x
+ // TODO: use dedicated struct in 3.x
// Stats QueueStats `json:"stats"`
Stats struct {
Workers int `json:"worker_count"`
@@ -211,7 +213,7 @@ type (
Level string `json:"log-level"`
}
- // LogEntry is a single log entry
+ // LogEntry is a single log entry.
LogEntry struct {
ID int64 `json:"id"`
StepID int64 `json:"step_id"`