-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add golangci lint to github action workflow #1068
Merged
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ec3a491
add golangci lint to github action workflow
suchen-sci 07ad3b7
add golang ci
suchen-sci 8848eb1
update code based on golangci lint
suchen-sci a731041
update workflow
suchen-sci 4747a4e
update based on githubci lint
suchen-sci 9a3d0f8
update based on githubci lint
suchen-sci 26ad18a
update based on githubci lint
suchen-sci 15983e2
update based on githubci lint
suchen-sci 1445cc4
update based on githubci lint
suchen-sci 65e9614
update based on githubci lint
suchen-sci ae74b8a
update based on githubci lint
suchen-sci db1b606
update based on githubci lint
suchen-sci be7ec3c
update based on githubci lint
suchen-sci 63392b8
update golang ci lint
suchen-sci 34d4174
update grpc related change
suchen-sci File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
update based on githubci lint
- Loading branch information
commit 9a3d0f8ff0f16508865f6c14b2cb4a351da09fae
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -514,11 +514,7 @@ func newMuxRule(rule *routers.Rule) *muxRule { | |
|
||
if seg.nodeType == ntStatic { | ||
p := path.Path | ||
if _, ok := mr.pathCache[p]; ok { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unnecessary guard. |
||
mr.pathCache[p] = append(mr.pathCache[p], newMuxPath(path)) | ||
} else { | ||
mr.pathCache[p] = []*muxPath{newMuxPath(path)} | ||
} | ||
mr.pathCache[p] = append(mr.pathCache[p], newMuxPath(path)) | ||
} else { | ||
mr.root.insert(path) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,25 +52,24 @@ func JSONToKVMap(jsonStr string) (map[string]string, error) { | |
func extractKVs(prefix string, obj interface{}) []map[string]string { | ||
var rst []map[string]string | ||
|
||
switch obj.(type) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unnecessary type assertion. |
||
switch o := obj.(type) { | ||
case map[string]interface{}: | ||
for k, v := range obj.(map[string]interface{}) { | ||
for k, v := range o { | ||
current := k | ||
rst = append(rst, extractKVs(join(prefix, current), v)...) | ||
} | ||
|
||
case []interface{}: | ||
o := obj.([]interface{}) | ||
length := len(o) | ||
for i := 0; i < length; i++ { | ||
rst = append(rst, extractKVs(join(prefix, strconv.Itoa(i)), o[i])...) | ||
} | ||
case bool: | ||
rst = append(rst, map[string]string{prefix: strconv.FormatBool(obj.(bool))}) | ||
rst = append(rst, map[string]string{prefix: strconv.FormatBool(o)}) | ||
case int: | ||
rst = append(rst, map[string]string{prefix: strconv.Itoa(obj.(int))}) | ||
rst = append(rst, map[string]string{prefix: strconv.Itoa(o)}) | ||
case float64: | ||
rst = append(rst, map[string]string{prefix: strconv.FormatFloat(obj.(float64), 'f', 0, 64)}) | ||
rst = append(rst, map[string]string{prefix: strconv.FormatFloat(o, 'f', 0, 64)}) | ||
default: | ||
if obj == nil { | ||
rst = append(rst, map[string]string{prefix: ""}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,53 +50,53 @@ type ( | |
Literal struct { | ||
// ScopeSuffix is the last part when build the credential scope. | ||
// Default: megaease_request | ||
ScopeSuffix string `json:"scopeSuffix" json:"scopeSuffix" jsonschema:"required"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
ScopeSuffix string `json:"scopeSuffix" jsonschema:"required"` | ||
|
||
// AlgorithmName is the query name of the signature algorithm | ||
// Default: X-Me-Algorithm | ||
AlgorithmName string `json:"algorithmName" json:"algorithmName" jsonschema:"required"` | ||
AlgorithmName string `json:"algorithmName" jsonschema:"required"` | ||
|
||
// AlgorithmName is the header/query value of the signature algorithm | ||
// Default: ME-HMAC-SHA256 | ||
AlgorithmValue string `json:"algorithmValue" json:"alrithmValue" jsonschema:"required"` | ||
AlgorithmValue string `json:"algorithmValue" jsonschema:"required"` | ||
|
||
// SignedHeaders is the header/query headers of the signed headers | ||
// Default: X-Me-SignedHeaders | ||
SignedHeaders string `json:"signedHeaders" json:"signedHeaders" jsonschema:"required"` | ||
SignedHeaders string `json:"signedHeaders" jsonschema:"required"` | ||
|
||
// Signature is the query name of the signature | ||
// Default: X-Me-Signature | ||
Signature string `json:"signature" json:"signature" jsonschema:"required"` | ||
Signature string `json:"signature" jsonschema:"required"` | ||
|
||
// Date is the header/query name of request time | ||
// Default: X-Me-Date | ||
Date string `json:"date" json:"date" jsonschema:"required"` | ||
Date string `json:"date" jsonschema:"required"` | ||
|
||
// Expires is the query name of expire duration | ||
// Default: X-Me-Expires | ||
Expires string `json:"expires" json:"expires" jsonschema:"required"` | ||
Expires string `json:"expires" jsonschema:"required"` | ||
|
||
// Credential is the query name of credential | ||
// Default: X-Me-Credential | ||
Credential string `json:"credential" json:"credential" jsonschema:"required"` | ||
Credential string `json:"credential" jsonschema:"required"` | ||
|
||
// ContentSHA256 is the header name of body/payload hash | ||
// Default: X-Me-Content-Sha256 | ||
ContentSHA256 string `json:"contentSha256" json:"contentSha256" jsonschema:"required"` | ||
ContentSHA256 string `json:"contentSha256" jsonschema:"required"` | ||
|
||
// SigningKeyPrefix is prepend to access key secret when derive the signing key | ||
// Default: ME | ||
SigningKeyPrefix string `json:"signingKeyPrefix" json:"signingKeyPrefix" jsonschema:"omitempty"` | ||
SigningKeyPrefix string `json:"signingKeyPrefix" jsonschema:"omitempty"` | ||
} | ||
|
||
// HeaderHoisting defines which headers are allowed to be moved from header to query | ||
// in presign: header with name has one of the allowed prefixes, but hasn't any | ||
// disallowed prefixes and doesn't match any of disallowed names are allowed to be | ||
// hoisted | ||
HeaderHoisting struct { | ||
AllowedPrefix []string `json:"allowedPrefix" json:"allowedPrefix" jsonschema:"omitempty,uniqueItems=true"` | ||
DisallowedPrefix []string `json:"disallowedPrefix" json:"disallowedPrefix" jsonschema:"omitempty,uniqueItems=true"` | ||
Disallowed []string `json:"disallowed" json:"disallowed" jsonschema:"omitempty,uniqueItems=true"` | ||
AllowedPrefix []string `json:"allowedPrefix" jsonschema:"omitempty,uniqueItems=true"` | ||
DisallowedPrefix []string `json:"disallowedPrefix" jsonschema:"omitempty,uniqueItems=true"` | ||
Disallowed []string `json:"disallowed" jsonschema:"omitempty,uniqueItems=true"` | ||
disallowed map[string]bool | ||
} | ||
|
||
|
@@ -781,7 +781,7 @@ func (ctx *Context) Verify(req *http.Request, getBody func() io.Reader) error { | |
return e | ||
} | ||
|
||
age := time.Now().Sub(ctx.Time) | ||
age := time.Since(ctx.Time) | ||
if ctx.signer.ttl > 0 { | ||
if age < -ctx.signer.ttl || age > ctx.signer.ttl { | ||
return fmt.Errorf("signature expired") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant return.