Fix linter (#1647)

This commit is contained in:
Anbraten 2023-03-18 20:35:27 +01:00 committed by GitHub
parent af2ef30205
commit fa5b0fb96e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 180 additions and 280 deletions

View file

@ -46,15 +46,16 @@ func (c *client) Next(ctx context.Context, f rpc.Filter) (*rpc.Pipeline, error)
res, err = c.client.Next(ctx, req)
if err == nil {
break
} else {
// TODO: remove after adding continuous data exchange by something like #536
if strings.Contains(err.Error(), "\"too_many_pings\"") {
// https://github.com/woodpecker-ci/woodpecker/issues/717#issuecomment-1049365104
log.Trace().Err(err).Msg("grpc: to many keepalive pings without sending data")
} else {
log.Err(err).Msgf("grpc error: done(): code: %v: %s", status.Code(err), err)
}
}
// TODO: remove after adding continuous data exchange by something like #536
if strings.Contains(err.Error(), "\"too_many_pings\"") {
// https://github.com/woodpecker-ci/woodpecker/issues/717#issuecomment-1049365104
log.Trace().Err(err).Msg("grpc: to many keepalive pings without sending data")
} else {
log.Err(err).Msgf("grpc error: done(): code: %v: %s", status.Code(err), err)
}
switch status.Code(err) {
case
codes.Aborted,
@ -94,9 +95,10 @@ func (c *client) Wait(ctx context.Context, id string) (err error) {
_, err = c.client.Wait(ctx, req)
if err == nil {
break
} else {
log.Err(err).Msgf("grpc error: wait(): code: %v: %s", status.Code(err), err)
}
log.Err(err).Msgf("grpc error: wait(): code: %v: %s", status.Code(err), err)
switch status.Code(err) {
case
codes.Aborted,
@ -128,9 +130,10 @@ func (c *client) Init(ctx context.Context, id string, state rpc.State) (err erro
_, err = c.client.Init(ctx, req)
if err == nil {
break
} else {
log.Err(err).Msgf("grpc error: init(): code: %v: %s", status.Code(err), err)
}
log.Err(err).Msgf("grpc error: init(): code: %v: %s", status.Code(err), err)
switch status.Code(err) {
case
codes.Aborted,
@ -162,9 +165,10 @@ func (c *client) Done(ctx context.Context, id string, state rpc.State) (err erro
_, err = c.client.Done(ctx, req)
if err == nil {
break
} else {
log.Err(err).Msgf("grpc error: done(): code: %v: %s", status.Code(err), err)
}
log.Err(err).Msgf("grpc error: done(): code: %v: %s", status.Code(err), err)
switch status.Code(err) {
case
codes.Aborted,
@ -189,9 +193,10 @@ func (c *client) Extend(ctx context.Context, id string) (err error) {
_, err = c.client.Extend(ctx, req)
if err == nil {
break
} else {
log.Err(err).Msgf("grpc error: extend(): code: %v: %s", status.Code(err), err)
}
log.Err(err).Msgf("grpc error: extend(): code: %v: %s", status.Code(err), err)
switch status.Code(err) {
case
codes.Aborted,
@ -223,9 +228,10 @@ func (c *client) Update(ctx context.Context, id string, state rpc.State) (err er
_, err = c.client.Update(ctx, req)
if err == nil {
break
} else {
log.Err(err).Msgf("grpc error: update(): code: %v: %s", status.Code(err), err)
}
log.Err(err).Msgf("grpc error: update(): code: %v: %s", status.Code(err), err)
switch status.Code(err) {
case
codes.Aborted,
@ -258,9 +264,10 @@ func (c *client) Upload(ctx context.Context, id string, file *rpc.File) (err err
_, err = c.client.Upload(ctx, req)
if err == nil {
break
} else {
log.Err(err).Msgf("grpc error: upload(): code: %v: %s", status.Code(err), err)
}
log.Err(err).Msgf("grpc error: upload(): code: %v: %s", status.Code(err), err)
switch status.Code(err) {
case
codes.Aborted,
@ -290,9 +297,10 @@ func (c *client) Log(ctx context.Context, id string, line *rpc.Line) (err error)
_, err = c.client.Log(ctx, req)
if err == nil {
break
} else {
log.Err(err).Msgf("grpc error: log(): code: %v: %s", status.Code(err), err)
}
log.Err(err).Msgf("grpc error: log(): code: %v: %s", status.Code(err), err)
switch status.Code(err) {
case
codes.Aborted,

View file

@ -84,9 +84,5 @@ func pipelineCreate(c *cli.Context) error {
return err
}
if err := tmpl.Execute(os.Stdout, pipeline); err != nil {
return err
}
return nil
return tmpl.Execute(os.Stdout, pipeline)
}

View file

@ -37,7 +37,7 @@ func init() {
http.HandleFunc("/version", handleVersion)
}
func handleHeartbeat(w http.ResponseWriter, r *http.Request) {
func handleHeartbeat(w http.ResponseWriter, _ *http.Request) {
if counter.Healthy() {
w.WriteHeader(200)
} else {
@ -45,7 +45,7 @@ func handleHeartbeat(w http.ResponseWriter, r *http.Request) {
}
}
func handleVersion(w http.ResponseWriter, r *http.Request) {
func handleVersion(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(200)
w.Header().Add("Content-Type", "text/json")
_ = json.NewEncoder(w).Encode(versionResp{
@ -54,7 +54,7 @@ func handleVersion(w http.ResponseWriter, r *http.Request) {
})
}
func handleStats(w http.ResponseWriter, r *http.Request) {
func handleStats(w http.ResponseWriter, _ *http.Request) {
if counter.Healthy() {
w.WriteHeader(200)
} else {

View file

@ -71,10 +71,10 @@ func setupStore(c *cli.Context) (store.Store, error) {
}
if driver == "sqlite3" {
if new, err := fallbackSqlite3File(datasource); err != nil {
if newDatasource, err := fallbackSqlite3File(datasource); err != nil {
log.Fatal().Err(err).Msg("fallback to old sqlite3 file failed")
} else {
datasource = new
datasource = newDatasource
}
}
@ -178,7 +178,7 @@ func setupRegistryService(c *cli.Context, s store.Store) model.RegistryService {
return registry.New(s)
}
func setupEnvironService(c *cli.Context, s store.Store) model.EnvironService {
func setupEnvironService(c *cli.Context, _ store.Store) model.EnvironService {
return environments.Parse(c.StringSlice("environment"))
}

View file

@ -78,8 +78,7 @@ func TestSplitVolumeParts(t *testing.T) {
}
for _, test := range testdata {
results, err := splitVolumeParts(test.from)
if test.success == (err != nil) {
} else {
if test.success != (err == nil) {
if reflect.DeepEqual(results, test.to) != test.success {
t.Errorf("Expect %q matches %q is %v", test.from, results, test.to)
}

View file

@ -70,7 +70,7 @@ func (e *local) Load() error {
}
// Setup the pipeline environment.
func (e *local) Setup(ctx context.Context, config *types.Config) error {
func (e *local) Setup(_ context.Context, _ *types.Config) error {
return nil
}

View file

@ -84,7 +84,7 @@ func (e *ssh) Load() error {
}
// Setup the pipeline environment.
func (e *ssh) Setup(ctx context.Context, config *types.Config) error {
func (e *ssh) Setup(_ context.Context, _ *types.Config) error {
return nil
}

View file

@ -18,49 +18,49 @@ package pipeline
// layer. Main purpose is to be compatible with drone plugins.
func SetDroneEnviron(env map[string]string) {
// webhook
copy("CI_COMMIT_BRANCH", "DRONE_BRANCH", env)
copy("CI_COMMIT_PULL_REQUEST", "DRONE_PULL_REQUEST", env)
copy("CI_COMMIT_TAG", "DRONE_TAG", env)
copy("CI_COMMIT_SOURCE_BRANCH", "DRONE_SOURCE_BRANCH", env)
copy("CI_COMMIT_TARGET_BRANCH", "DRONE_TARGET_BRANCH", env)
copyEnv("CI_COMMIT_BRANCH", "DRONE_BRANCH", env)
copyEnv("CI_COMMIT_PULL_REQUEST", "DRONE_PULL_REQUEST", env)
copyEnv("CI_COMMIT_TAG", "DRONE_TAG", env)
copyEnv("CI_COMMIT_SOURCE_BRANCH", "DRONE_SOURCE_BRANCH", env)
copyEnv("CI_COMMIT_TARGET_BRANCH", "DRONE_TARGET_BRANCH", env)
// pipeline
copy("CI_PIPELINE_NUMBER", "DRONE_BUILD_NUMBER", env)
copy("CI_PIPELINE_PARENT", "DRONE_BUILD_PARENT", env)
copy("CI_PIPELINE_EVENT", "DRONE_BUILD_EVENT", env)
copy("CI_PIPELINE_STATUS", "DRONE_BUILD_STATUS", env)
copy("CI_PIPELINE_LINK", "DRONE_BUILD_LINK", env)
copy("CI_PIPELINE_CREATED", "DRONE_BUILD_CREATED", env)
copy("CI_PIPELINE_STARTED", "DRONE_BUILD_STARTED", env)
copy("CI_PIPELINE_FINISHED", "DRONE_BUILD_FINISHED", env)
copyEnv("CI_PIPELINE_NUMBER", "DRONE_BUILD_NUMBER", env)
copyEnv("CI_PIPELINE_PARENT", "DRONE_BUILD_PARENT", env)
copyEnv("CI_PIPELINE_EVENT", "DRONE_BUILD_EVENT", env)
copyEnv("CI_PIPELINE_STATUS", "DRONE_BUILD_STATUS", env)
copyEnv("CI_PIPELINE_LINK", "DRONE_BUILD_LINK", env)
copyEnv("CI_PIPELINE_CREATED", "DRONE_BUILD_CREATED", env)
copyEnv("CI_PIPELINE_STARTED", "DRONE_BUILD_STARTED", env)
copyEnv("CI_PIPELINE_FINISHED", "DRONE_BUILD_FINISHED", env)
// commit
copy("CI_COMMIT_SHA", "DRONE_COMMIT", env)
copy("CI_COMMIT_SHA", "DRONE_COMMIT_SHA", env)
copy("CI_PREV_COMMIT_SHA", "DRONE_COMMIT_BEFORE", env)
copy("CI_COMMIT_REF", "DRONE_COMMIT_REF", env)
copy("CI_COMMIT_BRANCH", "DRONE_COMMIT_BRANCH", env)
copy("CI_COMMIT_LINK", "DRONE_COMMIT_LINK", env)
copy("CI_COMMIT_MESSAGE", "DRONE_COMMIT_MESSAGE", env)
copy("CI_COMMIT_AUTHOR", "DRONE_COMMIT_AUTHOR", env)
copy("CI_COMMIT_AUTHOR", "DRONE_COMMIT_AUTHOR_NAME", env)
copy("CI_COMMIT_AUTHOR_EMAIL", "DRONE_COMMIT_AUTHOR_EMAIL", env)
copy("CI_COMMIT_AUTHOR_AVATAR", "DRONE_COMMIT_AUTHOR_AVATAR", env)
copyEnv("CI_COMMIT_SHA", "DRONE_COMMIT", env)
copyEnv("CI_COMMIT_SHA", "DRONE_COMMIT_SHA", env)
copyEnv("CI_PREV_COMMIT_SHA", "DRONE_COMMIT_BEFORE", env)
copyEnv("CI_COMMIT_REF", "DRONE_COMMIT_REF", env)
copyEnv("CI_COMMIT_BRANCH", "DRONE_COMMIT_BRANCH", env)
copyEnv("CI_COMMIT_LINK", "DRONE_COMMIT_LINK", env)
copyEnv("CI_COMMIT_MESSAGE", "DRONE_COMMIT_MESSAGE", env)
copyEnv("CI_COMMIT_AUTHOR", "DRONE_COMMIT_AUTHOR", env)
copyEnv("CI_COMMIT_AUTHOR", "DRONE_COMMIT_AUTHOR_NAME", env)
copyEnv("CI_COMMIT_AUTHOR_EMAIL", "DRONE_COMMIT_AUTHOR_EMAIL", env)
copyEnv("CI_COMMIT_AUTHOR_AVATAR", "DRONE_COMMIT_AUTHOR_AVATAR", env)
// repo
copy("CI_REPO", "DRONE_REPO", env)
copy("CI_REPO_SCM", "DRONE_REPO_SCM", env)
copy("CI_REPO_OWNER", "DRONE_REPO_OWNER", env)
copy("CI_REPO_NAME", "DRONE_REPO_NAME", env)
copy("CI_REPO_LINK", "DRONE_REPO_LINK", env)
copy("CI_REPO_DEFAULT_BRANCH", "DRONE_REPO_BRANCH", env)
copy("CI_REPO_PRIVATE", "DRONE_REPO_PRIVATE", env)
copyEnv("CI_REPO", "DRONE_REPO", env)
copyEnv("CI_REPO_SCM", "DRONE_REPO_SCM", env)
copyEnv("CI_REPO_OWNER", "DRONE_REPO_OWNER", env)
copyEnv("CI_REPO_NAME", "DRONE_REPO_NAME", env)
copyEnv("CI_REPO_LINK", "DRONE_REPO_LINK", env)
copyEnv("CI_REPO_DEFAULT_BRANCH", "DRONE_REPO_BRANCH", env)
copyEnv("CI_REPO_PRIVATE", "DRONE_REPO_PRIVATE", env)
// clone
copy("CI_REPO_CLONE_URL", "DRONE_REMOTE_URL", env)
copy("CI_REPO_CLONE_URL", "DRONE_GIT_HTTP_URL", env)
copyEnv("CI_REPO_CLONE_URL", "DRONE_REMOTE_URL", env)
copyEnv("CI_REPO_CLONE_URL", "DRONE_GIT_HTTP_URL", env)
// misc
copy("CI_SYSTEM_HOST", "DRONE_SYSTEM_HOST", env)
copy("CI_STEP_NUMBER", "DRONE_STEP_NUMBER", env)
copyEnv("CI_SYSTEM_HOST", "DRONE_SYSTEM_HOST", env)
copyEnv("CI_STEP_NUMBER", "DRONE_STEP_NUMBER", env)
}
func copy(woodpecker, drone string, env map[string]string) {
func copyEnv(woodpecker, drone string, env map[string]string) {
var present bool
var value string

View file

@ -72,7 +72,7 @@ type s3Cacher struct {
region string
}
func (c *s3Cacher) Restore(repo, branch string, mounts []string) *yaml.Container {
func (c *s3Cacher) Restore(_, _ string, mounts []string) *yaml.Container {
return &yaml.Container{
Name: "rebuild_cache",
Image: "plugins/s3-cache:latest",
@ -87,7 +87,7 @@ func (c *s3Cacher) Restore(repo, branch string, mounts []string) *yaml.Container
}
}
func (c *s3Cacher) Rebuild(repo, branch string, mounts []string) *yaml.Container {
func (c *s3Cacher) Rebuild(_, _ string, mounts []string) *yaml.Container {
return &yaml.Container{
Name: "rebuild_cache",
Image: "plugins/s3-cache:latest",

View file

@ -37,13 +37,10 @@ func (l *Linter) Lint(c *yaml.Config) error {
if err := l.lint(c.Pipeline.Containers, blockPipeline); err != nil {
return err
}
if err := l.lint(c.Services.Containers, blockServices); err != nil {
return err
}
return nil
return l.lint(c.Services.Containers, blockServices)
}
func (l *Linter) lint(containers []*yaml.Container, block uint8) error {
func (l *Linter) lint(containers []*yaml.Container, _ uint8) error {
for _, container := range containers {
if err := l.lintImage(container); err != nil {
return err

View file

@ -223,12 +223,12 @@ func (c *config) File(ctx context.Context, u *model.User, r *model.Repo, p *mode
return []byte(*config), err
}
func (c *config) Dir(ctx context.Context, u *model.User, r *model.Repo, p *model.Pipeline, f string) ([]*forge_types.FileMeta, error) {
func (c *config) Dir(_ context.Context, _ *model.User, _ *model.Repo, _ *model.Pipeline, _ string) ([]*forge_types.FileMeta, error) {
return nil, forge_types.ErrNotImplemented
}
// Status creates a pipeline status for the Bitbucket commit.
func (c *config) Status(ctx context.Context, user *model.User, repo *model.Repo, pipeline *model.Pipeline, step *model.Step) error {
func (c *config) Status(ctx context.Context, user *model.User, repo *model.Repo, pipeline *model.Pipeline, _ *model.Step) error {
status := internal.PipelineStatus{
State: convertStatus(pipeline.Status),
Desc: common.GetPipelineStatusDescription(pipeline.Status),
@ -274,7 +274,7 @@ func (c *config) Deactivate(ctx context.Context, u *model.User, r *model.Repo, l
// Netrc returns a netrc file capable of authenticating Bitbucket requests and
// cloning Bitbucket repositories.
func (c *config) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error) {
func (c *config) Netrc(u *model.User, _ *model.Repo) (*model.Netrc, error) {
return &model.Netrc{
Machine: "bitbucket.org",
Login: "x-token-auth",
@ -297,14 +297,14 @@ func (c *config) Branches(ctx context.Context, u *model.User, r *model.Repo) ([]
}
// 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) (string, error) {
func (c *config) BranchHead(_ context.Context, _ *model.User, _ *model.Repo, _ string) (string, error) {
// TODO(1138): missing implementation
return "", forge_types.ErrNotImplemented
}
// Hook parses the incoming Bitbucket hook and returns the Repository and
// Pipeline details. If the hook is unsupported nil values are returned.
func (c *config) Hook(ctx context.Context, req *http.Request) (*model.Repo, *model.Pipeline, error) {
func (c *config) Hook(_ context.Context, req *http.Request) (*model.Repo, *model.Pipeline, error) {
return parseHook(req)
}

View file

@ -138,18 +138,18 @@ func (c *Config) Login(ctx context.Context, res http.ResponseWriter, req *http.R
}
// Auth is not supported by the Stash driver.
func (*Config) Auth(ctx context.Context, token, secret string) (string, error) {
func (*Config) Auth(_ context.Context, _, _ string) (string, error) {
return "", fmt.Errorf("Not Implemented")
}
// Teams is not supported by the Stash driver.
func (*Config) Teams(ctx context.Context, u *model.User) ([]*model.Team, error) {
func (*Config) Teams(_ context.Context, _ *model.User) ([]*model.Team, error) {
var teams []*model.Team
return teams, nil
}
// TeamPerm is not supported by the Stash driver.
func (*Config) TeamPerm(u *model.User, org string) (*model.Perm, error) {
func (*Config) TeamPerm(_ *model.User, _ string) (*model.Perm, error) {
return nil, nil
}
@ -186,12 +186,12 @@ func (c *Config) File(ctx context.Context, u *model.User, r *model.Repo, p *mode
return client.FindFileForRepo(r.Owner, r.Name, f, p.Ref)
}
func (c *Config) Dir(ctx context.Context, u *model.User, r *model.Repo, p *model.Pipeline, f string) ([]*forge_types.FileMeta, error) {
func (c *Config) Dir(_ context.Context, _ *model.User, _ *model.Repo, _ *model.Pipeline, _ string) ([]*forge_types.FileMeta, error) {
return nil, forge_types.ErrNotImplemented
}
// Status is not supported by the bitbucketserver driver.
func (c *Config) Status(ctx context.Context, user *model.User, repo *model.Repo, pipeline *model.Pipeline, step *model.Step) error {
func (c *Config) Status(ctx context.Context, user *model.User, repo *model.Repo, pipeline *model.Pipeline, _ *model.Step) error {
status := internal.PipelineStatus{
State: convertStatus(pipeline.Status),
Desc: common.GetPipelineStatusDescription(pipeline.Status),
@ -205,7 +205,7 @@ func (c *Config) Status(ctx context.Context, user *model.User, repo *model.Repo,
return client.CreateStatus(pipeline.Commit, &status)
}
func (c *Config) Netrc(user *model.User, r *model.Repo) (*model.Netrc, error) {
func (c *Config) Netrc(_ *model.User, r *model.Repo) (*model.Netrc, error) {
host, err := common.ExtractHostFromCloneURL(r.Clone)
if err != nil {
return nil, err
@ -239,7 +239,7 @@ func (c *Config) Branches(ctx context.Context, u *model.User, r *model.Repo) ([]
}
// 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) (string, error) {
func (c *Config) BranchHead(_ context.Context, _ *model.User, _ *model.Repo, _ string) (string, error) {
// TODO(1138): missing implementation
return "", forge_types.ErrNotImplemented
}
@ -249,13 +249,13 @@ func (c *Config) Deactivate(ctx context.Context, u *model.User, r *model.Repo, l
return client.DeleteHook(r.Owner, r.Name, link)
}
func (c *Config) Hook(ctx context.Context, r *http.Request) (*model.Repo, *model.Pipeline, error) {
func (c *Config) Hook(_ context.Context, r *http.Request) (*model.Repo, *model.Pipeline, error) {
return parseHook(r, c.URL)
}
// OrgMembership returns if user is member of organization and if user
// is admin/owner in this organization.
func (c *Config) OrgMembership(ctx context.Context, u *model.User, owner string) (*model.OrgPerm, error) {
func (c *Config) OrgMembership(_ context.Context, _ *model.User, _ string) (*model.OrgPerm, error) {
// TODO: Not implemented currently
return nil, nil
}

View file

@ -124,7 +124,7 @@ func (c *Coding) Login(ctx context.Context, res http.ResponseWriter, req *http.R
// Auth authenticates the session and returns the forge user
// login for the given token and secret
func (c *Coding) Auth(ctx context.Context, token, secret string) (string, error) {
func (c *Coding) Auth(ctx context.Context, token, _ string) (string, error) {
user, err := c.newClientToken(ctx, token).GetCurrentUser()
if err != nil {
return "", err
@ -150,14 +150,14 @@ func (c *Coding) Refresh(ctx context.Context, u *model.User) (bool, error) {
}
// Teams fetches a list of team memberships from the forge.
func (c *Coding) Teams(ctx context.Context, u *model.User) ([]*model.Team, error) {
func (c *Coding) Teams(_ context.Context, _ *model.User) ([]*model.Team, error) {
// EMPTY: not implemented in Coding OAuth API
return nil, forge_types.ErrNotImplemented
}
// TeamPerm fetches the named organization permissions from
// the forge for the specified user.
func (c *Coding) TeamPerm(u *model.User, org string) (*model.Perm, error) {
func (c *Coding) TeamPerm(_ *model.User, _ string) (*model.Perm, error) {
// EMPTY: not implemented in Coding OAuth API
return nil, nil
}
@ -245,12 +245,12 @@ func (c *Coding) File(ctx context.Context, u *model.User, r *model.Repo, b *mode
return data, nil
}
func (c *Coding) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]*forge_types.FileMeta, error) {
func (c *Coding) Dir(_ context.Context, _ *model.User, _ *model.Repo, _ *model.Pipeline, _ string) ([]*forge_types.FileMeta, error) {
return nil, forge_types.ErrNotImplemented
}
// Status sends the commit status to the forge.
func (c *Coding) Status(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, step *model.Step) error {
func (c *Coding) Status(_ context.Context, _ *model.User, _ *model.Repo, _ *model.Pipeline, _ *model.Step) error {
// EMPTY: not implemented in Coding OAuth API
return nil
}
@ -290,20 +290,20 @@ func (c *Coding) Deactivate(ctx context.Context, u *model.User, r *model.Repo, l
}
// Branches returns the names of all branches for the named repository.
func (c *Coding) Branches(ctx context.Context, u *model.User, r *model.Repo) ([]string, error) {
func (c *Coding) Branches(_ context.Context, _ *model.User, r *model.Repo) ([]string, error) {
// TODO: fetch all branches
return []string{r.Branch}, nil
}
// BranchHead returns the sha of the head (latest commit) of the specified branch
func (c *Coding) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (string, error) {
func (c *Coding) BranchHead(_ context.Context, _ *model.User, _ *model.Repo, _ string) (string, error) {
// TODO(1138): missing implementation
return "", forge_types.ErrNotImplemented
}
// Hook parses the post-commit hook from the Request body and returns the
// required data in a standard format.
func (c *Coding) Hook(ctx context.Context, r *http.Request) (*model.Repo, *model.Pipeline, error) {
func (c *Coding) Hook(_ context.Context, r *http.Request) (*model.Repo, *model.Pipeline, error) {
repo, pipeline, err := parseHook(r)
if pipeline != nil {
pipeline.Avatar = c.resourceLink(pipeline.Avatar)
@ -313,7 +313,7 @@ func (c *Coding) Hook(ctx context.Context, r *http.Request) (*model.Repo, *model
// OrgMembership returns if user is member of organization and if user
// is admin/owner in this organization.
func (c *Coding) OrgMembership(ctx context.Context, u *model.User, owner string) (*model.OrgPerm, error) {
func (c *Coding) OrgMembership(_ context.Context, _ *model.User, _ string) (*model.OrgPerm, error) {
// TODO: Not supported in Coding OAuth API
return nil, nil
}

View file

@ -153,7 +153,7 @@ func (c *Gitea) Login(ctx context.Context, w http.ResponseWriter, req *http.Requ
// Auth uses the Gitea oauth2 access token and refresh token to authenticate
// a session and return the Gitea account login.
func (c *Gitea) Auth(ctx context.Context, token, secret string) (string, error) {
func (c *Gitea) Auth(ctx context.Context, token, _ string) (string, error) {
client, err := c.newClientToken(ctx, token)
if err != nil {
return "", err
@ -213,7 +213,7 @@ func (c *Gitea) Teams(ctx context.Context, u *model.User) ([]*model.Team, error)
}
// TeamPerm is not supported by the Gitea driver.
func (c *Gitea) TeamPerm(u *model.User, org string) (*model.Perm, error) {
func (c *Gitea) TeamPerm(_ *model.User, _ string) (*model.Perm, error) {
return nil, nil
}

View file

@ -137,7 +137,7 @@ func (c *client) Login(ctx context.Context, res http.ResponseWriter, req *http.R
}
// Auth returns the GitHub user login for the given access token.
func (c *client) Auth(ctx context.Context, token, secret string) (string, error) {
func (c *client) Auth(ctx context.Context, token, _ string) (string, error) {
client := c.newClientToken(ctx, token)
user, _, err := client.Users.Get(ctx, "")
if err != nil {

View file

@ -76,7 +76,7 @@ func (c *client) Name() string {
// Login authenticates an account with Gogs using basic authentication. The
// Gogs account details are returned when the user is successfully authenticated.
func (c *client) Login(ctx context.Context, res http.ResponseWriter, req *http.Request) (*model.User, error) {
func (c *client) Login(_ context.Context, res http.ResponseWriter, req *http.Request) (*model.User, error) {
var (
username = req.FormValue("username")
password = req.FormValue("password")
@ -130,12 +130,12 @@ func (c *client) Login(ctx context.Context, res http.ResponseWriter, req *http.R
}
// Auth is not supported by the Gogs driver.
func (c *client) Auth(ctx context.Context, token, secret string) (string, error) {
func (c *client) Auth(_ context.Context, _, _ string) (string, error) {
return "", fmt.Errorf("Not Implemented")
}
// Teams is not supported by the Gogs driver.
func (c *client) Teams(ctx context.Context, u *model.User) ([]*model.Team, error) {
func (c *client) Teams(_ context.Context, u *model.User) ([]*model.Team, error) {
client := c.newClientToken(u.Token)
orgs, err := client.ListMyOrgs()
if err != nil {
@ -150,7 +150,7 @@ func (c *client) Teams(ctx context.Context, u *model.User) ([]*model.Team, error
}
// Repo returns the named Gogs repository.
func (c *client) Repo(ctx context.Context, u *model.User, _ model.ForgeRemoteID, owner, name string) (*model.Repo, error) {
func (c *client) Repo(_ context.Context, u *model.User, _ model.ForgeRemoteID, owner, name string) (*model.Repo, error) {
client := c.newClientToken(u.Token)
repo, err := client.GetRepo(owner, name)
if err != nil {
@ -161,7 +161,7 @@ func (c *client) Repo(ctx context.Context, u *model.User, _ model.ForgeRemoteID,
// Repos returns a list of all repositories for the Gogs account, including
// organization repositories.
func (c *client) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error) {
func (c *client) Repos(_ context.Context, u *model.User) ([]*model.Repo, error) {
var repos []*model.Repo
client := c.newClientToken(u.Token)
@ -177,7 +177,7 @@ func (c *client) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error
}
// Perm returns the user permissions for the named Gogs repository.
func (c *client) Perm(ctx context.Context, u *model.User, r *model.Repo) (*model.Perm, error) {
func (c *client) Perm(_ context.Context, u *model.User, r *model.Repo) (*model.Perm, error) {
client := c.newClientToken(u.Token)
repo, err := client.GetRepo(r.Owner, r.Name)
if err != nil {
@ -187,7 +187,7 @@ func (c *client) Perm(ctx context.Context, u *model.User, r *model.Repo) (*model
}
// File fetches the file from the Gogs repository and returns its contents.
func (c *client) File(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]byte, error) {
func (c *client) File(_ context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]byte, error) {
client := c.newClientToken(u.Token)
ref := b.Commit
@ -210,12 +210,12 @@ func (c *client) File(ctx context.Context, u *model.User, r *model.Repo, b *mode
return cfg, err
}
func (c *client) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]*forge_types.FileMeta, error) {
func (c *client) Dir(_ context.Context, _ *model.User, _ *model.Repo, _ *model.Pipeline, _ string) ([]*forge_types.FileMeta, error) {
return nil, forge_types.ErrNotImplemented
}
// Status is not supported by the Gogs driver.
func (c *client) Status(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, step *model.Step) error {
func (c *client) Status(_ context.Context, _ *model.User, _ *model.Repo, _ *model.Pipeline, _ *model.Step) error {
return nil
}
@ -244,7 +244,7 @@ func (c *client) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error) {
// Activate activates the repository by registering post-commit hooks with
// the Gogs repository.
func (c *client) Activate(ctx context.Context, u *model.User, r *model.Repo, link string) error {
func (c *client) Activate(_ context.Context, u *model.User, r *model.Repo, link string) error {
config := map[string]string{
"url": link,
"secret": r.Hash,
@ -263,12 +263,12 @@ func (c *client) Activate(ctx context.Context, u *model.User, r *model.Repo, lin
}
// Deactivate is not supported by the Gogs driver.
func (c *client) Deactivate(ctx context.Context, u *model.User, r *model.Repo, link string) error {
func (c *client) Deactivate(_ context.Context, _ *model.User, _ *model.Repo, _ string) error {
return nil
}
// Branches returns the names of all branches for the named repository.
func (c *client) Branches(ctx context.Context, u *model.User, r *model.Repo) ([]string, error) {
func (c *client) Branches(_ context.Context, u *model.User, r *model.Repo) ([]string, error) {
token := ""
if u != nil {
token = u.Token
@ -287,7 +287,7 @@ func (c *client) Branches(ctx context.Context, u *model.User, r *model.Repo) ([]
}
// BranchHead returns sha of commit on top of the specified branch
func (c *client) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (string, error) {
func (c *client) BranchHead(_ context.Context, u *model.User, r *model.Repo, branch string) (string, error) {
token := ""
if u != nil {
token = u.Token
@ -301,13 +301,13 @@ func (c *client) BranchHead(ctx context.Context, u *model.User, r *model.Repo, b
// Hook parses the incoming Gogs hook and returns the Repository and Pipeline
// details. If the hook is unsupported nil values are returned.
func (c *client) Hook(ctx context.Context, r *http.Request) (*model.Repo, *model.Pipeline, error) {
func (c *client) Hook(_ context.Context, r *http.Request) (*model.Repo, *model.Pipeline, error) {
return parseHook(r, c.PrivateMode)
}
// OrgMembership returns if user is member of organization and if user
// is admin/owner in this organization.
func (c *client) OrgMembership(ctx context.Context, u *model.User, owner string) (*model.OrgPerm, error) {
func (c *client) OrgMembership(_ context.Context, u *model.User, owner string) (*model.OrgPerm, error) {
client := c.newClientToken(u.Token)
orgs, err := client.ListMyOrgs()

View file

@ -22,8 +22,8 @@ func NewWoodpeckerAuthServer(jwtManager *JWTManager, agentMasterToken string, st
return &WoodpeckerAuthServer{jwtManager: jwtManager, agentMasterToken: agentMasterToken, store: store}
}
func (s *WoodpeckerAuthServer) Auth(c context.Context, req *proto.AuthRequest) (*proto.AuthReply, error) {
agent, err := s.getAgent(c, req.AgentId, req.AgentToken)
func (s *WoodpeckerAuthServer) Auth(_ context.Context, req *proto.AuthRequest) (*proto.AuthReply, error) {
agent, err := s.getAgent(req.AgentId, req.AgentToken)
if err != nil {
return nil, err
}
@ -40,7 +40,7 @@ func (s *WoodpeckerAuthServer) Auth(c context.Context, req *proto.AuthRequest) (
}, nil
}
func (s *WoodpeckerAuthServer) getAgent(c context.Context, agentID int64, agentToken string) (*model.Agent, error) {
func (s *WoodpeckerAuthServer) getAgent(agentID int64, agentToken string) (*model.Agent, error) {
if agentToken == s.agentMasterToken && agentID == -1 {
agent := new(model.Agent)
agent.Name = ""

View file

@ -174,7 +174,7 @@ func (s *RPC) Update(c context.Context, id string, state rpc.State) error {
}
// Upload implements the rpc.Upload function
func (s *RPC) Upload(c context.Context, id string, file *rpc.File) error {
func (s *RPC) Upload(_ context.Context, id string, file *rpc.File) error {
stepID, err := strconv.ParseInt(id, 10, 64)
if err != nil {
return err

View file

@ -46,7 +46,7 @@ func New() Log {
}
}
func (l *log) Open(c context.Context, path string) error {
func (l *log) Open(_ context.Context, path string) error {
l.Lock()
_, ok := l.streams[path]
if !ok {
@ -60,7 +60,7 @@ func (l *log) Open(c context.Context, path string) error {
return nil
}
func (l *log) Write(c context.Context, path string, entry *Entry) error {
func (l *log) Write(_ context.Context, path string, entry *Entry) error {
l.Lock()
s, ok := l.streams[path]
l.Unlock()
@ -105,7 +105,7 @@ func (l *log) Tail(c context.Context, path string, handler Handler) error {
return nil
}
func (l *log) Close(c context.Context, path string) error {
func (l *log) Close(_ context.Context, path string) error {
l.Lock()
s, ok := l.streams[path]
l.Unlock()
@ -123,7 +123,7 @@ func (l *log) Close(c context.Context, path string) error {
return nil
}
func (l *log) Snapshot(c context.Context, path string, w io.Writer) error {
func (l *log) Snapshot(_ context.Context, path string, w io.Writer) error {
l.Lock()
s, ok := l.streams[path]
l.Unlock()

View file

@ -28,7 +28,7 @@ import (
"github.com/woodpecker-ci/woodpecker/server/store"
)
func createPipelineItems(ctx context.Context, store store.Store,
func createPipelineItems(_ context.Context, store store.Store,
currentPipeline *model.Pipeline, user *model.User, repo *model.Repo,
yamls []*forge_types.FileMeta, envs map[string]string,
) (*model.Pipeline, []*pipeline.Item, error) {

View file

@ -25,7 +25,7 @@ import (
type mockUpdatePipelineStore struct{}
func (m *mockUpdatePipelineStore) UpdatePipeline(pipeline *model.Pipeline) error {
func (m *mockUpdatePipelineStore) UpdatePipeline(_ *model.Pipeline) error {
return nil
}

View file

@ -26,7 +26,7 @@ import (
"github.com/woodpecker-ci/woodpecker/server/queue"
)
func queueBuild(pipeline *model.Pipeline, repo *model.Repo, pipelineItems []*pipeline.Item) error {
func queuePipeline(repo *model.Repo, pipelineItems []*pipeline.Item) error {
var tasks []*queue.Task
for _, item := range pipelineItems {
if item.Step.State == model.StatusSkipped {

View file

@ -128,13 +128,13 @@ func persistPipelineConfigs(store store.Store, configs []*model.Config, pipeline
}
func createNewOutOfOld(old *model.Pipeline) *model.Pipeline {
new := *old
new.ID = 0
new.Number = 0
new.Status = model.StatusPending
new.Started = 0
new.Finished = 0
new.Enqueued = time.Now().UTC().Unix()
new.Error = ""
return &new
newPipeline := *old
newPipeline.ID = 0
newPipeline.Number = 0
newPipeline.Status = model.StatusPending
newPipeline.Started = 0
newPipeline.Finished = 0
newPipeline.Enqueued = time.Now().UTC().Unix()
newPipeline.Error = ""
return &newPipeline
}

View file

@ -41,8 +41,8 @@ func start(ctx context.Context, store store.Store, activePipeline *model.Pipelin
log.Error().Err(err).Msg("publishToTopic")
}
if err := queueBuild(activePipeline, repo, pipelineItems); err != nil {
log.Error().Err(err).Msg("queueBuild")
if err := queuePipeline(repo, pipelineItems); err != nil {
log.Error().Err(err).Msg("queuePipeline")
return nil, err
}

View file

@ -25,7 +25,7 @@ import (
type mockUpdateStepStore struct{}
func (m *mockUpdateStepStore) StepUpdate(build *model.Step) error {
func (m *mockUpdateStepStore) StepUpdate(_ *model.Step) error {
return nil
}

View file

@ -28,6 +28,6 @@ func Parse(params []string) model.EnvironService {
return &builtin{globals}
}
func (b *builtin) EnvironList(repo *model.Repo) ([]*model.Environ, error) {
func (b *builtin) EnvironList(_ *model.Repo) ([]*model.Environ, error) {
return b.globals, nil
}

View file

@ -21,11 +21,11 @@ func (b *db) RegistryList(repo *model.Repo) ([]*model.Registry, error) {
return b.store.RegistryList(repo)
}
func (b *db) RegistryCreate(repo *model.Repo, in *model.Registry) error {
func (b *db) RegistryCreate(_ *model.Repo, in *model.Registry) error {
return b.store.RegistryCreate(in)
}
func (b *db) RegistryUpdate(repo *model.Repo, in *model.Registry) error {
func (b *db) RegistryUpdate(_ *model.Repo, in *model.Registry) error {
return b.store.RegistryUpdate(in)
}

View file

@ -38,7 +38,7 @@ func (b *builtin) SecretList(repo *model.Repo) ([]*model.Secret, error) {
return b.store.SecretList(repo, false)
}
func (b *builtin) SecretListPipeline(repo *model.Repo, pipeline *model.Pipeline) ([]*model.Secret, error) {
func (b *builtin) SecretListPipeline(repo *model.Repo, _ *model.Pipeline) ([]*model.Secret, error) {
s, err := b.store.SecretList(repo, true)
if err != nil {
return nil, err
@ -70,11 +70,11 @@ func (b *builtin) SecretListPipeline(repo *model.Repo, pipeline *model.Pipeline)
return secrets, nil
}
func (b *builtin) SecretCreate(repo *model.Repo, in *model.Secret) error {
func (b *builtin) SecretCreate(_ *model.Repo, in *model.Secret) error {
return b.store.SecretCreate(in)
}
func (b *builtin) SecretUpdate(repo *model.Repo, in *model.Secret) error {
func (b *builtin) SecretUpdate(_ *model.Repo, in *model.Secret) error {
return b.store.SecretUpdate(in)
}
@ -94,11 +94,11 @@ func (b *builtin) OrgSecretList(owner string) ([]*model.Secret, error) {
return b.store.OrgSecretList(owner)
}
func (b *builtin) OrgSecretCreate(owner string, in *model.Secret) error {
func (b *builtin) OrgSecretCreate(_ string, in *model.Secret) error {
return b.store.SecretCreate(in)
}
func (b *builtin) OrgSecretUpdate(owner string, in *model.Secret) error {
func (b *builtin) OrgSecretUpdate(_ string, in *model.Secret) error {
return b.store.SecretUpdate(in)
}

View file

@ -22,7 +22,7 @@ func New() Publisher {
}
}
func (p *publisher) Create(c context.Context, dest string) error {
func (p *publisher) Create(_ context.Context, dest string) error {
p.Lock()
_, ok := p.topics[dest]
if !ok {
@ -33,7 +33,7 @@ func (p *publisher) Create(c context.Context, dest string) error {
return nil
}
func (p *publisher) Publish(c context.Context, dest string, message Message) error {
func (p *publisher) Publish(_ context.Context, dest string, message Message) error {
p.Lock()
t, ok := p.topics[dest]
p.Unlock()
@ -63,7 +63,7 @@ func (p *publisher) Subscribe(c context.Context, dest string, receiver Receiver)
return nil
}
func (p *publisher) Remove(c context.Context, dest string) error {
func (p *publisher) Remove(_ context.Context, dest string) error {
p.Lock()
t, ok := p.topics[dest]
if ok {

View file

@ -56,7 +56,7 @@ type fifo struct {
}
// New returns a new fifo queue.
func New(ctx context.Context) Queue {
func New(_ context.Context) Queue {
return &fifo{
workers: map[*worker]struct{}{},
running: map[string]*entry{},
@ -68,7 +68,7 @@ func New(ctx context.Context) Queue {
}
// Push pushes an item to the tail of this queue.
func (q *fifo) Push(c context.Context, task *Task) error {
func (q *fifo) Push(_ context.Context, task *Task) error {
q.Lock()
q.pending.PushBack(task)
q.Unlock()
@ -77,7 +77,7 @@ func (q *fifo) Push(c context.Context, task *Task) error {
}
// Push pushes an item to the tail of this queue.
func (q *fifo) PushAtOnce(c context.Context, tasks []*Task) error {
func (q *fifo) PushAtOnce(_ context.Context, tasks []*Task) error {
q.Lock()
for _, task := range tasks {
q.pending.PushBack(task)
@ -112,17 +112,17 @@ func (q *fifo) Poll(c context.Context, f FilterFn) (*Task, error) {
}
// Done signals that the item is done executing.
func (q *fifo) Done(c context.Context, id string, exitStatus model.StatusValue) error {
func (q *fifo) Done(_ context.Context, id string, exitStatus model.StatusValue) error {
return q.finished([]string{id}, string(exitStatus), nil)
}
// Error signals that the item is done executing with error.
func (q *fifo) Error(c context.Context, id string, err error) error {
func (q *fifo) Error(_ context.Context, id string, err error) error {
return q.finished([]string{id}, StatusFailure, err)
}
// Error signals that the item is done executing with error.
func (q *fifo) ErrorAtOnce(c context.Context, id []string, err error) error {
func (q *fifo) ErrorAtOnce(_ context.Context, id []string, err error) error {
return q.finished(id, StatusFailure, err)
}
@ -151,7 +151,7 @@ func (q *fifo) Evict(c context.Context, id string) error {
}
// Evict removes a pending task from the queue.
func (q *fifo) EvictAtOnce(c context.Context, ids []string) error {
func (q *fifo) EvictAtOnce(_ context.Context, ids []string) error {
q.Lock()
defer q.Unlock()
@ -185,7 +185,7 @@ func (q *fifo) Wait(c context.Context, id string) error {
}
// Extend extends the task execution deadline.
func (q *fifo) Extend(c context.Context, id string) error {
func (q *fifo) Extend(_ context.Context, id string) error {
q.Lock()
defer q.Unlock()
@ -198,7 +198,7 @@ func (q *fifo) Extend(c context.Context, id string) error {
}
// Info returns internal queue information.
func (q *fifo) Info(c context.Context) InfoT {
func (q *fifo) Info(_ context.Context) InfoT {
q.Lock()
stats := InfoT{}
stats.Stats.Workers = len(q.workers)

View file

@ -23,7 +23,7 @@ import (
// Store is a middleware function that initializes the Datastore and attaches to
// the context of every http.Request.
func Store(cli *cli.Context, v store.Store) gin.HandlerFunc {
func Store(_ *cli.Context, v store.Store) gin.HandlerFunc {
return func(c *gin.Context) {
store.ToContext(c, v)
c.Next()

View file

@ -41,7 +41,7 @@ func (s storage) CronList(repo *model.Repo) ([]*model.Cron, error) {
return crons, s.engine.Where("repo_id = ?", repo.ID).Find(&crons)
}
func (s storage) CronUpdate(repo *model.Repo, cron *model.Cron) error {
func (s storage) CronUpdate(_ *model.Repo, cron *model.Cron) error {
_, err := s.engine.ID(cron.ID).AllCols().Update(cron)
return err
}

View file

@ -39,10 +39,7 @@ var renameRemoteToForge = task{
if err := sess.Sync2(new(oldRepo012)); err != nil {
return err
}
if err := renameColumn(sess, "repos", "remote_id", "forge_id"); err != nil {
return err
}
return nil
return renameColumn(sess, "repos", "remote_id", "forge_id")
},
}

View file

@ -22,10 +22,6 @@ var renameForgeIDToForgeRemoteID = task{
name: "rename-forge-id-to-forge-remote-id",
required: true,
fn: func(sess *xorm.Session) error {
if err := renameColumn(sess, "repos", "forge_id", "forge_remote_id"); err != nil {
return err
}
return nil
return renameColumn(sess, "repos", "forge_id", "forge_remote_id")
},
}

View file

@ -43,16 +43,16 @@ func createSQLiteDB(t *testing.T) string {
return tmpF.Name()
}
func testDB(t *testing.T, new bool) (engine *xorm.Engine, close func()) {
func testDB(t *testing.T, new bool) (engine *xorm.Engine, closeDB func()) {
driver := testDriver()
var err error
close = func() {}
closeDB = func() {}
switch driver {
case "sqlite3":
config := ":memory:"
if !new {
config = createSQLiteDB(t)
close = func() {
closeDB = func() {
_ = os.Remove(config)
}
}
@ -86,9 +86,9 @@ func TestMigrate(t *testing.T) {
}
// init new db
engine, close := testDB(t, true)
engine, closeDB := testDB(t, true)
assert.NoError(t, Migrate(engine))
close()
closeDB()
dbType := engine.Dialect().URI().DBType
if dbType == schemas.MYSQL || dbType == schemas.POSTGRES {
@ -97,7 +97,7 @@ func TestMigrate(t *testing.T) {
}
// migrate old db
engine, close = testDB(t, false)
engine, closeDB = testDB(t, false)
assert.NoError(t, Migrate(engine))
close()
closeDB()
}

View file

@ -1,93 +0,0 @@
// Copyright 2018 Drone.IO Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// 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.
package swagger
import (
"net/http"
"github.com/woodpecker-ci/woodpecker/server/model"
)
// swagger:route GET /users/{login} user getUser
//
// Get the user with the matching login.
//
// Responses:
// 200: user
func userFind(w http.ResponseWriter, r *http.Request) {}
// swagger:route GET /user user getCurrentUser
//
// Get the currently authenticated user.
//
// Responses:
// 200: user
func userCurrent(w http.ResponseWriter, r *http.Request) {}
// swagger:route GET /users user getUserList
//
// Get the list of all registered users.
//
// Responses:
// 200: user
func userList(w http.ResponseWriter, r *http.Request) {}
// swagger:route GET /user/feed user getUserFeed
//
// Get the currently authenticated user's pipeline feed.
//
// Responses:
// 200: feed
func userFeed(w http.ResponseWriter, r *http.Request) {}
// swagger:route DELETE /users/{login} user deleteUserLogin
//
// Delete the user with the matching login.
//
// Responses:
// 200: user
func userDelete(w http.ResponseWriter, r *http.Request) {}
// swagger:route GET /user/repos user getUserRepos
//
// Get the currently authenticated user's active repository list.
//
// Responses:
// 200: repos
func repoList(w http.ResponseWriter, r *http.Request) {}
// swagger:response user
type userResp struct {
// in: body
Body model.User
}
// swagger:response users
type usersResp struct {
// in: body
Body []model.User
}
// swagger:response feed
type feedResp struct {
// in: body
Body []model.Feed
}
// swagger:response repos
type reposResp struct {
// in: body
Body []model.Repo
}

View file

@ -530,9 +530,9 @@ func (c *client) post(rawurl string, in, out interface{}) error {
}
// helper function for making an http PUT request.
func (c *client) put(rawurl string, in, out interface{}) error {
return c.do(rawurl, "PUT", in, out)
}
// func (c *client) put(rawurl string, in, out interface{}) error {
// return c.do(rawurl, "PUT", in, out)
// }
// helper function for making an http PATCH request.
func (c *client) patch(rawurl string, in, out interface{}) error {
@ -546,7 +546,7 @@ func (c *client) delete(rawurl string) error {
// helper function to make an http request
func (c *client) do(rawurl, method string, in, out interface{}) error {
body, err := c.open(rawurl, method, in, out)
body, err := c.open(rawurl, method, in)
if err != nil {
return err
}
@ -558,7 +558,7 @@ func (c *client) do(rawurl, method string, in, out interface{}) error {
}
// helper function to open an http request
func (c *client) open(rawurl, method string, in, out interface{}) (io.ReadCloser, error) {
func (c *client) open(rawurl, method string, in interface{}) (io.ReadCloser, error) {
uri, err := url.Parse(rawurl)
if err != nil {
return nil, err