diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..cb63814 --- /dev/null +++ b/.github/workflows/lint.yml @@ -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 diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..d3e7a15 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,3 @@ +linters: + disable: + - errcheck \ No newline at end of file diff --git a/cback/http/cback.go b/cback/http/cback.go index bf2be87..788d221 100644 --- a/cback/http/cback.go +++ b/cback/http/cback.go @@ -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"` diff --git a/cernboxspaces/cernboxspaces.go b/cernboxspaces/cernboxspaces.go index c3c008d..3794bda 100644 --- a/cernboxspaces/cernboxspaces.go +++ b/cernboxspaces/cernboxspaces.go @@ -166,7 +166,7 @@ func (p *cboxProj) GetProjectsHandler(w http.ResponseWriter, r *http.Request) { return } - w.Write(data) + _, err = w.Write(data) } func (p *cboxProj) GetProjectAdmins(w http.ResponseWriter, r *http.Request) { diff --git a/share/sql/sql.go b/share/sql/sql.go index 285b84a..a7b857d 100644 --- a/share/sql/sql.go +++ b/share/sql/sql.go @@ -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