Skip to content

Commit

Permalink
Upgrade golang-ci version
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 committed Mar 11, 2021
1 parent 4a470fd commit 56bca06
Show file tree
Hide file tree
Showing 41 changed files with 160 additions and 171 deletions.
6 changes: 1 addition & 5 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ issues:
text: "SA1019:"
linters:
- staticcheck
- path: pkg/publicshare/manager/json/json.go
text: "SA1019:"
linters:
- staticcheck
- path: internal/grpc/services/gateway/publicshareprovider.go
- path: pkg/utils/utils.go
text: "SA1019:"
linters:
- staticcheck
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ contrib:

# for manual building only
deps:
cd /tmp && rm -rf golangci-lint && git clone --quiet -b 'v1.26.0' --single-branch --depth 1 https://github.com/golangci/golangci-lint &> /dev/null && cd golangci-lint/cmd/golangci-lint && go install
cd /tmp && rm -rf golangci-lint && git clone --quiet -b 'v1.38.0' --single-branch --depth 1 https://github.com/golangci/golangci-lint &> /dev/null && cd golangci-lint/cmd/golangci-lint && go install
cd /tmp && go get golang.org/x/tools/cmd/goimports

build-ci: off
Expand Down
2 changes: 1 addition & 1 deletion cmd/revad/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func initCPUCount(conf *coreConf, log *zerolog.Logger) {
log.Error().Err(err).Msg("error adjusting number of cpus")
os.Exit(1)
}
//log.Info().Msgf("%s", getVersionString())
// log.Info().Msgf("%s", getVersionString())
log.Info().Msgf("running on %d cpus", ncpus)
}

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ require (
golang.org/x/sys v0.0.0-20210218155724-8ebf48af031b
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221
google.golang.org/grpc v1.36.0
google.golang.org/protobuf v1.23.0
)

go 1.13
Expand Down
10 changes: 5 additions & 5 deletions grpc-tests/userprovider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,23 @@ func Test_service_GetUser(t *testing.T) {

for _, tt := range providers {
t.Run(tt.name, func(t *testing.T) {
//start revad with the specific provider
// start revad with the specific provider
cmd := exec.Command("../cmd/revad/revad", "-c", "userproviders/"+tt.name+".toml")
err := cmd.Start()

if err != nil {
t.Fatalf("Could not start revad! ERROR: %v", err)
}

//wait till port is open
// wait till port is open
_ = waitForPort("open")

//even the port is open the service might not be available yet
// even the port is open the service might not be available yet
time.Sleep(1 * time.Second)

GetUser(t, tt.existingIdp)

//kill revad
// kill revad
err = cmd.Process.Signal(os.Kill)
if err != nil {
t.Fatalf("Could not kill revad! ERROR: %v", err)
Expand Down Expand Up @@ -184,7 +184,7 @@ func GetUser(t *testing.T, existingIdp string) {
if tt.want.User == nil {
assert.Nil(t, userResp.User)
} else {
//make sure not to run into a nil pointer error
// make sure not to run into a nil pointer error
if userResp.User == nil {
t.Fatalf("no user in response %v", userResp)
}
Expand Down
8 changes: 4 additions & 4 deletions internal/grpc/services/appregistry/appregistry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func Test_ListAppProviders(t *testing.T) {
"currently/ignored": "an other address",
},

//only Status and Providers will be asserted in the tests
// only Status and Providers will be asserted in the tests
want: &registrypb.ListAppProvidersResponse{
Status: &rpcv1beta1.Status{
Code: 1,
Expand Down Expand Up @@ -79,7 +79,7 @@ func Test_ListAppProviders(t *testing.T) {
name: "empty rules",
rules: map[string]interface{}{},

//only Status and Providers will be asserted in the tests
// only Status and Providers will be asserted in the tests
want: &registrypb.ListAppProvidersResponse{
Status: &rpcv1beta1.Status{
Code: 1,
Expand All @@ -97,7 +97,7 @@ func Test_ListAppProviders(t *testing.T) {
"text/json": nil,
},

//only Status and Providers will be asserted in the tests
// only Status and Providers will be asserted in the tests
want: &registrypb.ListAppProvidersResponse{
Status: &rpcv1beta1.Status{
Code: 1,
Expand Down Expand Up @@ -154,7 +154,7 @@ func Test_GetAppProviders(t *testing.T) {
{
name: "simple",
search: &providerv1beta1.ResourceInfo{MimeType: "text/json"},
//only Status and Providers will be asserted in the tests
// only Status and Providers will be asserted in the tests
want: &registrypb.GetAppProvidersResponse{
Status: &rpcv1beta1.Status{
Code: 1,
Expand Down
2 changes: 1 addition & 1 deletion internal/grpc/services/gateway/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1861,7 +1861,7 @@ func (s *svc) GetQuota(ctx context.Context, req *gateway.GetQuotaRequest) (*prov

res, err := c.GetQuota(ctx, &provider.GetQuotaRequest{
Opaque: req.GetOpaque(),
//Ref: req.GetRef(), // TODO send which storage space ... or root
// Ref: req.GetRef(), // TODO send which storage space ... or root
})
if err != nil {
return nil, errors.Wrap(err, "gateway: error calling GetQuota")
Expand Down
2 changes: 1 addition & 1 deletion internal/grpc/services/storageprovider/transcoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (x XS) String() string { return string(x) }
const (
// XSInvalid means the checksum type is invalid.
XSInvalid XS = "invalid"
//XSUnset means the checksum is optional.
// XSUnset means the checksum is optional.
XSUnset = "unset"
// XSAdler32 means the checksum is adler32
XSAdler32 = "adler32"
Expand Down
12 changes: 6 additions & 6 deletions internal/http/services/owncloud/ocdav/propfind.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ const (
// RFC1123 time that mimics oc10. time.RFC1123 would end in "UTC", see https://github.com/golang/go/issues/13781
RFC1123 = "Mon, 02 Jan 2006 15:04:05 GMT"

//_propQuotaUncalculated = "-1"
// _propQuotaUncalculated = "-1"
_propQuotaUnknown = "-2"
//_propQuotaUnlimited = "-3"
// _propQuotaUnlimited = "-3"
)

// ns is the namespace that is prefixed to the path in the cs3 namespace
Expand Down Expand Up @@ -184,7 +184,7 @@ func (s *svc) handlePropfind(w http.ResponseWriter, r *http.Request, ns string)
// check sub-containers in reverse order and add them to the stack
// the reversed order here will produce a more logical sorting of results
for i := len(res.Infos) - 1; i >= 0; i-- {
//for i := range res.Infos {
// for i := range res.Infos {
if res.Infos[i].Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER {
stack = append(stack, res.Infos[i].Path)
}
Expand Down Expand Up @@ -420,10 +420,10 @@ func (s *svc) mdToPropResponse(ctx context.Context, pf *propfindXML, md *provide
if ls == nil {
propstatOK.Prop = append(propstatOK.Prop, s.newProp("oc:size", size))
}
// A <DAV:allprop> PROPFIND request SHOULD NOT return DAV:quota-available-bytes and DAV:quota-used-bytes
// A <DAV:allprop> PROPFIND request SHOULD NOT return DAV:quota-available-bytes and DAV:quota-used-bytes
// from https://www.rfc-editor.org/rfc/rfc4331.html#section-2
//propstatOK.Prop = append(propstatOK.Prop, s.newProp("d:quota-used-bytes", size))
//propstatOK.Prop = append(propstatOK.Prop, s.newProp("d:quota-available-bytes", quota))
// propstatOK.Prop = append(propstatOK.Prop, s.newProp("d:quota-used-bytes", size))
// propstatOK.Prop = append(propstatOK.Prop, s.newProp("d:quota-available-bytes", quota))
} else {
propstatOK.Prop = append(propstatOK.Prop,
s.newProp("d:resourcetype", ""),
Expand Down
2 changes: 1 addition & 1 deletion internal/http/services/owncloud/ocdav/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
func (s *svc) handleReport(w http.ResponseWriter, r *http.Request, ns string) {
ctx := r.Context()
log := appctx.GetLogger(ctx)
//fn := path.Join(ns, r.URL.Path)
// fn := path.Join(ns, r.URL.Path)

rep, status, err := readReport(r.Body)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/http/services/owncloud/ocdav/trashbin.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (h *TrashbinHandler) Handler(s *svc) http.Handler {
key, r.URL.Path = router.ShiftPath(r.URL.Path)

// TODO another options handler should not be necessary
//if r.Method == http.MethodOptions {
// if r.Method == http.MethodOptions {
// s.doOptions(w, r, "trashbin")
// return
//}
Expand Down
2 changes: 1 addition & 1 deletion internal/http/services/owncloud/ocdav/tus.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (s *svc) handleTusPost(w http.ResponseWriter, r *http.Request, ns string) {
// TODO must be SHA1, ADLER32 or MD5 ... in capital letters????
// curl -X PUT https://demo.owncloud.com/remote.php/webdav/testcs.bin -u demo:demo -d '123' -v -H 'OC-Checksum: SHA1:40bd001563085fc35165329ea1ff5c5ecbdbbeef'

//TODO check Expect: 100-continue
// TODO check Expect: 100-continue

// read filename from metadata
meta := tusd.ParseMetadataHeader(r.Header.Get("Upload-Metadata"))
Expand Down
2 changes: 1 addition & 1 deletion internal/http/services/owncloud/ocdav/unlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"net/http"
)

//TODO(jfd): implement unlock
// TODO(jfd): implement unlock
func (s *svc) handleUnlock(w http.ResponseWriter, r *http.Request, ns string) {
w.WriteHeader(http.StatusNotImplemented)
}
12 changes: 6 additions & 6 deletions internal/http/services/owncloud/ocdav/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,29 +138,29 @@ func (h *VersionsHandler) doListVersions(w http.ResponseWriter, r *http.Request,
MimeType: "httpd/unix-directory",
Mtime: info.Mtime,
Path: "v",
//PermissionSet
// PermissionSet
Size: 0,
Owner: info.Owner,
})

for i := range versions {
vi := &provider.ResourceInfo{
// TODO(jfd) we cannot access version content, this will be a problem when trying to fetch version thumbnails
//Opaque
// Opaque
Type: provider.ResourceType_RESOURCE_TYPE_FILE,
Id: &provider.ResourceId{
StorageId: "versions", // this is a virtual storage
OpaqueId: info.Id.OpaqueId + "@" + versions[i].GetKey(),
},
//Checksum
//Etag: v.ETag,
//MimeType
// Checksum
// Etag: v.ETag,
// MimeType
Mtime: &types.Timestamp{
Seconds: versions[i].Mtime,
// TODO cs3apis FileVersion should use types.Timestamp instead of uint64
},
Path: path.Join("v", versions[i].Key),
//PermissionSet
// PermissionSet
Size: versions[i].Size,
Owner: info.Owner,
}
Expand Down
2 changes: 1 addition & 1 deletion internal/http/services/owncloud/ocs/conversions/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (r *Role) OCSPermissions() Permissions {
// M = Mounted
func (r *Role) WebDAVPermissions(isDir, isShared, isMountpoint, isPublic bool) string {
var b strings.Builder
//b.Grow(7)
// b.Grow(7)
if !isPublic && isShared {
fmt.Fprintf(&b, "S")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func setCapabilitiesForChunkProtocol(cp chunkProtocol, c *data.CapabilitiesData)
c.Capabilities.Files.TusSupport = nil

case chunkNG:
//2.7+ will use Chunking NG if "capabilities > files > bigfilechunking" is "true" AND "capabilities > dav > chunking" = 1.0
// 2.7+ will use Chunking NG if "capabilities > files > bigfilechunking" is "true" AND "capabilities > dav > chunking" = 1.0
c.Capabilities.Files.BigFileChunking = true
c.Capabilities.Dav.Chunking = "1.0"
c.Capabilities.Files.TusSupport = nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type Users struct {
Email string `json:"email" xml:"email"`
DisplayName string `json:"displayname" xml:"displayname"`
// FIXME home should never be exposed ... even in oc 10
//home
// home
TwoFactorAuthEnabled bool `json:"two_factor_auth_enabled" xml:"two_factor_auth_enabled"`
}

Expand Down
46 changes: 23 additions & 23 deletions internal/http/services/wellknown/openidconfiguration.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,40 +58,40 @@ func (s *svc) doOpenidConfiguration(w http.ResponseWriter, r *http.Request) {
// TODO(labkode): do we really need it to validate the token and get user claims?
type ProviderMetadata struct {
AuthorizationEndpoint string `json:"authorization_endpoint,omitempty"`
//claims_parameter_supported
// claims_parameter_supported
ClaimsSupported []string `json:"claims_supported,omitempty"`
//grant_types_supported
// grant_types_supported
IDTokenSigningAlgValuesSupported []string `json:"id_token_signing_alg_values_supported,omitempty"`
Issuer string `json:"issuer,omitempty"`
JwksURI string `json:"jwks_uri,omitempty"`
//registration_endpoint
//request_object_signing_alg_values_supported
//request_parameter_supported
//request_uri_parameter_supported
//require_request_uri_registration
//response_modes_supported
// registration_endpoint
// request_object_signing_alg_values_supported
// request_parameter_supported
// request_uri_parameter_supported
// require_request_uri_registration
// response_modes_supported
ResponseTypesSupported []string `json:"response_types_supported,omitempty"`
ScopesSupported []string `json:"scopes_supported,omitempty"`
SubjectTypesSupported []string `json:"subject_types_supported,omitempty"`
TokenEndpoint string `json:"token_endpoint,omitempty"`
//token_endpoint_auth_methods_supported
//token_endpoint_auth_signing_alg_values_supported
// token_endpoint_auth_methods_supported
// token_endpoint_auth_signing_alg_values_supported
UserinfoEndpoint string `json:"userinfo_endpoint,omitempty"`
//userinfo_signing_alg_values_supported
//code_challenge_methods_supported
// userinfo_signing_alg_values_supported
// code_challenge_methods_supported
IntrospectionEndpoint string `json:"introspection_endpoint,omitempty"`
//introspection_endpoint_auth_methods_supported
//introspection_endpoint_auth_signing_alg_values_supported
// introspection_endpoint_auth_methods_supported
// introspection_endpoint_auth_signing_alg_values_supported
RevocationEndpoint string `json:"revocation_endpoint,omitempty"`
//revocation_endpoint_auth_methods_supported
//revocation_endpoint_auth_signing_alg_values_supported
//id_token_encryption_alg_values_supported
//id_token_encryption_enc_values_supported
//userinfo_encryption_alg_values_supported
//userinfo_encryption_enc_values_supported
//request_object_encryption_alg_values_supported
//request_object_encryption_enc_values_supported
// revocation_endpoint_auth_methods_supported
// revocation_endpoint_auth_signing_alg_values_supported
// id_token_encryption_alg_values_supported
// id_token_encryption_enc_values_supported
// userinfo_encryption_alg_values_supported
// userinfo_encryption_enc_values_supported
// request_object_encryption_alg_values_supported
// request_object_encryption_enc_values_supported
CheckSessionIframe string `json:"check_session_iframe,omitempty"`
EndSessionEndpoint string `json:"end_session_endpoint,omitempty"`
//claim_types_supported
// claim_types_supported
}
2 changes: 1 addition & 1 deletion pkg/auth/manager/json/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func TestGetManagerWithJSONObject(t *testing.T) {
assert.EqualError(t, err, tt.expectedError.message)
}
})
//cleanup
// cleanup
os.Remove(tmpFile.Name())
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/auth/manager/oidc/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ func (am *mgr) Authenticate(ctx context.Context, clientID, clientSecret string)
}
log.Debug().Interface("claims", claims).Interface("userInfo", userInfo).Msg("unmarshalled userinfo")

if claims["issuer"] == nil { //This is not set in simplesamlphp
if claims["issuer"] == nil { // This is not set in simplesamlphp
claims["issuer"] = am.c.Issuer
}
if claims["email_verified"] == nil { //This is not set in simplesamlphp
if claims["email_verified"] == nil { // This is not set in simplesamlphp
claims["email_verified"] = false
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/eosclient/eosgrpc/eos_grpc/eos_grpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ message ManilaRequest {
}

message ManilaResponse {
string msg = 1; //for generic messages
string msg = 1; // for generic messages
int32 code = 2; // < 1 is an error -- > 1 is OK
int64 total_used = 3;
int64 total_capacity = 4;
Expand Down
2 changes: 1 addition & 1 deletion pkg/eosclient/eosgrpc/eosgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ func (c *Client) GetFileInfoByPath(ctx context.Context, uid, gid, path string) (
// - "File not found is not an error", it's a legitimate result of a legitimate check
// - Assuming that any error means file not found is doubly poisonous
return nil, errtypes.NotFound(err.Error())
//return nil, nil
// return nil, nil
}

if rsp == nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func init() {
type Mode string

const (
//JSONMode outputs JSON.
// JSONMode outputs JSON.
JSONMode Mode = "json"
// ConsoleMode outputs human-readable logs.
ConsoleMode Mode = "console"
Expand Down
Loading

0 comments on commit 56bca06

Please sign in to comment.