Skip to content

Commit

Permalink
Add linter
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegeens committed Feb 7, 2025
1 parent da1f18f commit a50c40d
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 4 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Write me a workflow that will lint the code with golangci-lint

name: lint

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: true
# Cloning outside of workspace is currently not possible, see https://github.com/actions/checkout/issues/197
# Therefore, we move later
# (we need ../reva available due to a replace in the go.mod file)
- name: Cloning reva
uses: actions/checkout@v4
with:
repository: cs3org/reva
path: reva
- run: mv reva ../reva
- name: Go mod tidy
run: go mod tidy
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --timeout=5m
3 changes: 3 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters:
disable:
- errcheck
2 changes: 0 additions & 2 deletions cback/http/cback.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ func init() {
reva.RegisterPlugin(svc{})
}

const webdavPrefix = "/remote.php/dav/files/"

type config struct {
Prefix string `mapstructure:"prefix"`
Token string `mapstructure:"token"`
Expand Down
2 changes: 1 addition & 1 deletion cernboxspaces/cernboxspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (p *cboxProj) GetProjectsHandler(w http.ResponseWriter, r *http.Request) {
return
}

w.Write(data)
_, err = w.Write(data)

Check failure on line 169 in cernboxspaces/cernboxspaces.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to err (ineffassign)
}

func (p *cboxProj) GetProjectAdmins(w http.ResponseWriter, r *http.Request) {
Expand Down
2 changes: 1 addition & 1 deletion share/sql/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (m *mgr) GetShare(ctx context.Context, ref *collaboration.ShareReference) (
return nil, err
}
default:
err = errtypes.NotFound(ref.String())
return nil, errtypes.NotFound(ref.String())
}

// resolve grantee's user type if applicable
Expand Down

0 comments on commit a50c40d

Please sign in to comment.