Skip to content

Commit ec2fd99

Browse files
Merge pull request #28 from sashamelentyev/test/crypto
test/crypto
2 parents 3691826 + ad4bbd9 commit ec2fd99

File tree

2 files changed

+149
-104
lines changed

2 files changed

+149
-104
lines changed

pkg/analyzer/mapping.go

Lines changed: 100 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -30,118 +30,116 @@ var cryptoHash = map[string]string{
3030
crypto.BLAKE2b_512.String(): "crypto.BLAKE2b_512.String()",
3131
}
3232

33-
var (
34-
httpMethod = map[string]string{
35-
http.MethodGet: "http.MethodGet",
36-
http.MethodHead: "http.MethodHead",
37-
http.MethodPost: "http.MethodPost",
38-
http.MethodPut: "http.MethodPut",
39-
http.MethodPatch: "http.MethodPatch",
40-
http.MethodDelete: "http.MethodDelete",
41-
http.MethodConnect: "http.MethodConnect",
42-
http.MethodOptions: "http.MethodOptions",
43-
http.MethodTrace: "http.MethodTrace",
44-
}
45-
httpStatusCode = map[string]string{
46-
strconv.Itoa(http.StatusContinue): "http.StatusContinue",
47-
strconv.Itoa(http.StatusSwitchingProtocols): "http.StatusSwitchingProtocols",
48-
strconv.Itoa(http.StatusProcessing): "http.StatusProcessing",
49-
strconv.Itoa(http.StatusEarlyHints): "http.StatusEarlyHints",
33+
var httpMethod = map[string]string{
34+
http.MethodGet: "http.MethodGet",
35+
http.MethodHead: "http.MethodHead",
36+
http.MethodPost: "http.MethodPost",
37+
http.MethodPut: "http.MethodPut",
38+
http.MethodPatch: "http.MethodPatch",
39+
http.MethodDelete: "http.MethodDelete",
40+
http.MethodConnect: "http.MethodConnect",
41+
http.MethodOptions: "http.MethodOptions",
42+
http.MethodTrace: "http.MethodTrace",
43+
}
5044

51-
strconv.Itoa(http.StatusOK): "http.StatusOK",
52-
strconv.Itoa(http.StatusCreated): "http.StatusCreated",
53-
strconv.Itoa(http.StatusAccepted): "http.StatusAccepted",
54-
strconv.Itoa(http.StatusNonAuthoritativeInfo): "http.StatusNonAuthoritativeInfo",
55-
strconv.Itoa(http.StatusNoContent): "http.StatusNoContent",
56-
strconv.Itoa(http.StatusResetContent): "http.StatusResetContent",
57-
strconv.Itoa(http.StatusPartialContent): "http.StatusPartialContent",
58-
strconv.Itoa(http.StatusMultiStatus): "http.StatusMultiStatus",
59-
strconv.Itoa(http.StatusAlreadyReported): "http.StatusAlreadyReported",
60-
strconv.Itoa(http.StatusIMUsed): "http.StatusIMUsed",
45+
var httpStatusCode = map[string]string{
46+
strconv.Itoa(http.StatusContinue): "http.StatusContinue",
47+
strconv.Itoa(http.StatusSwitchingProtocols): "http.StatusSwitchingProtocols",
48+
strconv.Itoa(http.StatusProcessing): "http.StatusProcessing",
49+
strconv.Itoa(http.StatusEarlyHints): "http.StatusEarlyHints",
6150

62-
strconv.Itoa(http.StatusMultipleChoices): "http.StatusMultipleChoices",
63-
strconv.Itoa(http.StatusMovedPermanently): "http.StatusMovedPermanently",
64-
strconv.Itoa(http.StatusFound): "http.StatusFound",
65-
strconv.Itoa(http.StatusSeeOther): "http.StatusSeeOther",
66-
strconv.Itoa(http.StatusNotModified): "http.StatusNotModified",
67-
strconv.Itoa(http.StatusUseProxy): "http.StatusUseProxy",
68-
strconv.Itoa(http.StatusTemporaryRedirect): "http.StatusTemporaryRedirect",
69-
strconv.Itoa(http.StatusPermanentRedirect): "http.StatusPermanentRedirect",
51+
strconv.Itoa(http.StatusOK): "http.StatusOK",
52+
strconv.Itoa(http.StatusCreated): "http.StatusCreated",
53+
strconv.Itoa(http.StatusAccepted): "http.StatusAccepted",
54+
strconv.Itoa(http.StatusNonAuthoritativeInfo): "http.StatusNonAuthoritativeInfo",
55+
strconv.Itoa(http.StatusNoContent): "http.StatusNoContent",
56+
strconv.Itoa(http.StatusResetContent): "http.StatusResetContent",
57+
strconv.Itoa(http.StatusPartialContent): "http.StatusPartialContent",
58+
strconv.Itoa(http.StatusMultiStatus): "http.StatusMultiStatus",
59+
strconv.Itoa(http.StatusAlreadyReported): "http.StatusAlreadyReported",
60+
strconv.Itoa(http.StatusIMUsed): "http.StatusIMUsed",
7061

71-
strconv.Itoa(http.StatusBadRequest): "http.StatusBadRequest",
72-
strconv.Itoa(http.StatusUnauthorized): "http.StatusUnauthorized",
73-
strconv.Itoa(http.StatusPaymentRequired): "http.StatusPaymentRequired",
74-
strconv.Itoa(http.StatusForbidden): "http.StatusForbidden",
75-
strconv.Itoa(http.StatusNotFound): "http.StatusNotFound",
76-
strconv.Itoa(http.StatusMethodNotAllowed): "http.StatusMethodNotAllowed",
77-
strconv.Itoa(http.StatusNotAcceptable): "http.StatusNotAcceptable",
78-
strconv.Itoa(http.StatusProxyAuthRequired): "http.StatusProxyAuthRequired",
79-
strconv.Itoa(http.StatusRequestTimeout): "http.StatusRequestTimeout",
80-
strconv.Itoa(http.StatusConflict): "http.StatusConflict",
81-
strconv.Itoa(http.StatusGone): "http.StatusGone",
82-
strconv.Itoa(http.StatusLengthRequired): "http.StatusLengthRequired",
83-
strconv.Itoa(http.StatusPreconditionFailed): "http.StatusPreconditionFailed",
84-
strconv.Itoa(http.StatusRequestEntityTooLarge): "http.StatusRequestEntityTooLarge",
85-
strconv.Itoa(http.StatusRequestURITooLong): "http.StatusRequestURITooLong",
86-
strconv.Itoa(http.StatusUnsupportedMediaType): "http.StatusUnsupportedMediaType",
87-
strconv.Itoa(http.StatusRequestedRangeNotSatisfiable): "http.StatusRequestedRangeNotSatisfiable",
88-
strconv.Itoa(http.StatusExpectationFailed): "http.StatusExpectationFailed",
89-
strconv.Itoa(http.StatusTeapot): "http.StatusTeapot",
90-
strconv.Itoa(http.StatusMisdirectedRequest): "http.StatusMisdirectedRequest",
91-
strconv.Itoa(http.StatusUnprocessableEntity): "http.StatusUnprocessableEntity",
92-
strconv.Itoa(http.StatusLocked): "http.StatusLocked",
93-
strconv.Itoa(http.StatusFailedDependency): "http.StatusFailedDependency",
94-
strconv.Itoa(http.StatusTooEarly): "http.StatusTooEarly",
95-
strconv.Itoa(http.StatusUpgradeRequired): "http.StatusUpgradeRequired",
96-
strconv.Itoa(http.StatusPreconditionRequired): "http.StatusPreconditionRequired",
97-
strconv.Itoa(http.StatusTooManyRequests): "http.StatusTooManyRequests",
98-
strconv.Itoa(http.StatusRequestHeaderFieldsTooLarge): "http.StatusRequestHeaderFieldsTooLarge",
99-
strconv.Itoa(http.StatusUnavailableForLegalReasons): "http.StatusUnavailableForLegalReasons",
62+
strconv.Itoa(http.StatusMultipleChoices): "http.StatusMultipleChoices",
63+
strconv.Itoa(http.StatusMovedPermanently): "http.StatusMovedPermanently",
64+
strconv.Itoa(http.StatusFound): "http.StatusFound",
65+
strconv.Itoa(http.StatusSeeOther): "http.StatusSeeOther",
66+
strconv.Itoa(http.StatusNotModified): "http.StatusNotModified",
67+
strconv.Itoa(http.StatusUseProxy): "http.StatusUseProxy",
68+
strconv.Itoa(http.StatusTemporaryRedirect): "http.StatusTemporaryRedirect",
69+
strconv.Itoa(http.StatusPermanentRedirect): "http.StatusPermanentRedirect",
10070

101-
strconv.Itoa(http.StatusInternalServerError): "http.StatusInternalServerError",
102-
strconv.Itoa(http.StatusNotImplemented): "http.StatusNotImplemented",
103-
strconv.Itoa(http.StatusBadGateway): "http.StatusBadGateway",
104-
strconv.Itoa(http.StatusServiceUnavailable): "http.StatusServiceUnavailable",
105-
strconv.Itoa(http.StatusGatewayTimeout): "http.StatusGatewayTimeout",
106-
strconv.Itoa(http.StatusHTTPVersionNotSupported): "http.StatusHTTPVersionNotSupported",
107-
strconv.Itoa(http.StatusVariantAlsoNegotiates): "http.StatusVariantAlsoNegotiates",
108-
strconv.Itoa(http.StatusInsufficientStorage): "http.StatusInsufficientStorage",
109-
strconv.Itoa(http.StatusLoopDetected): "http.StatusLoopDetected",
110-
strconv.Itoa(http.StatusNotExtended): "http.StatusNotExtended",
111-
strconv.Itoa(http.StatusNetworkAuthenticationRequired): "http.StatusNetworkAuthenticationRequired",
112-
}
113-
)
71+
strconv.Itoa(http.StatusBadRequest): "http.StatusBadRequest",
72+
strconv.Itoa(http.StatusUnauthorized): "http.StatusUnauthorized",
73+
strconv.Itoa(http.StatusPaymentRequired): "http.StatusPaymentRequired",
74+
strconv.Itoa(http.StatusForbidden): "http.StatusForbidden",
75+
strconv.Itoa(http.StatusNotFound): "http.StatusNotFound",
76+
strconv.Itoa(http.StatusMethodNotAllowed): "http.StatusMethodNotAllowed",
77+
strconv.Itoa(http.StatusNotAcceptable): "http.StatusNotAcceptable",
78+
strconv.Itoa(http.StatusProxyAuthRequired): "http.StatusProxyAuthRequired",
79+
strconv.Itoa(http.StatusRequestTimeout): "http.StatusRequestTimeout",
80+
strconv.Itoa(http.StatusConflict): "http.StatusConflict",
81+
strconv.Itoa(http.StatusGone): "http.StatusGone",
82+
strconv.Itoa(http.StatusLengthRequired): "http.StatusLengthRequired",
83+
strconv.Itoa(http.StatusPreconditionFailed): "http.StatusPreconditionFailed",
84+
strconv.Itoa(http.StatusRequestEntityTooLarge): "http.StatusRequestEntityTooLarge",
85+
strconv.Itoa(http.StatusRequestURITooLong): "http.StatusRequestURITooLong",
86+
strconv.Itoa(http.StatusUnsupportedMediaType): "http.StatusUnsupportedMediaType",
87+
strconv.Itoa(http.StatusRequestedRangeNotSatisfiable): "http.StatusRequestedRangeNotSatisfiable",
88+
strconv.Itoa(http.StatusExpectationFailed): "http.StatusExpectationFailed",
89+
strconv.Itoa(http.StatusTeapot): "http.StatusTeapot",
90+
strconv.Itoa(http.StatusMisdirectedRequest): "http.StatusMisdirectedRequest",
91+
strconv.Itoa(http.StatusUnprocessableEntity): "http.StatusUnprocessableEntity",
92+
strconv.Itoa(http.StatusLocked): "http.StatusLocked",
93+
strconv.Itoa(http.StatusFailedDependency): "http.StatusFailedDependency",
94+
strconv.Itoa(http.StatusTooEarly): "http.StatusTooEarly",
95+
strconv.Itoa(http.StatusUpgradeRequired): "http.StatusUpgradeRequired",
96+
strconv.Itoa(http.StatusPreconditionRequired): "http.StatusPreconditionRequired",
97+
strconv.Itoa(http.StatusTooManyRequests): "http.StatusTooManyRequests",
98+
strconv.Itoa(http.StatusRequestHeaderFieldsTooLarge): "http.StatusRequestHeaderFieldsTooLarge",
99+
strconv.Itoa(http.StatusUnavailableForLegalReasons): "http.StatusUnavailableForLegalReasons",
100+
101+
strconv.Itoa(http.StatusInternalServerError): "http.StatusInternalServerError",
102+
strconv.Itoa(http.StatusNotImplemented): "http.StatusNotImplemented",
103+
strconv.Itoa(http.StatusBadGateway): "http.StatusBadGateway",
104+
strconv.Itoa(http.StatusServiceUnavailable): "http.StatusServiceUnavailable",
105+
strconv.Itoa(http.StatusGatewayTimeout): "http.StatusGatewayTimeout",
106+
strconv.Itoa(http.StatusHTTPVersionNotSupported): "http.StatusHTTPVersionNotSupported",
107+
strconv.Itoa(http.StatusVariantAlsoNegotiates): "http.StatusVariantAlsoNegotiates",
108+
strconv.Itoa(http.StatusInsufficientStorage): "http.StatusInsufficientStorage",
109+
strconv.Itoa(http.StatusLoopDetected): "http.StatusLoopDetected",
110+
strconv.Itoa(http.StatusNotExtended): "http.StatusNotExtended",
111+
strconv.Itoa(http.StatusNetworkAuthenticationRequired): "http.StatusNetworkAuthenticationRequired",
112+
}
114113

115114
var defaultRPCPath = map[string]string{
116115
rpc.DefaultRPCPath: "rpc.DefaultRPCPath",
117116
rpc.DefaultDebugPath: "rpc.DefaultDebugPath",
118117
}
119118

120-
var (
121-
timeWeekday = map[string]string{
122-
time.Sunday.String(): "time.Sunday.String()",
123-
time.Monday.String(): "time.Monday.String()",
124-
time.Tuesday.String(): "time.Tuesday.String()",
125-
time.Wednesday.String(): "time.Wednesday.String()",
126-
time.Thursday.String(): "time.Thursday.String()",
127-
time.Friday.String(): "time.Friday.String()",
128-
time.Saturday.String(): "time.Saturday.String()",
129-
}
130-
timeMonth = map[string]string{
131-
time.January.String(): "time.January.String()",
132-
time.February.String(): "time.February.String()",
133-
time.March.String(): "time.March.String()",
134-
time.April.String(): "time.April.String()",
135-
time.May.String(): "time.May.String()",
136-
time.June.String(): "time.June.String()",
137-
time.July.String(): "time.July.String()",
138-
time.August.String(): "time.August.String()",
139-
time.September.String(): "time.September.String()",
140-
time.October.String(): "time.October.String()",
141-
time.November.String(): "time.November.String()",
142-
time.December.String(): "time.December.String()",
143-
}
144-
)
119+
var timeWeekday = map[string]string{
120+
time.Sunday.String(): "time.Sunday.String()",
121+
time.Monday.String(): "time.Monday.String()",
122+
time.Tuesday.String(): "time.Tuesday.String()",
123+
time.Wednesday.String(): "time.Wednesday.String()",
124+
time.Thursday.String(): "time.Thursday.String()",
125+
time.Friday.String(): "time.Friday.String()",
126+
time.Saturday.String(): "time.Saturday.String()",
127+
}
128+
129+
var timeMonth = map[string]string{
130+
time.January.String(): "time.January.String()",
131+
time.February.String(): "time.February.String()",
132+
time.March.String(): "time.March.String()",
133+
time.April.String(): "time.April.String()",
134+
time.May.String(): "time.May.String()",
135+
time.June.String(): "time.June.String()",
136+
time.July.String(): "time.July.String()",
137+
time.August.String(): "time.August.String()",
138+
time.September.String(): "time.September.String()",
139+
time.October.String(): "time.October.String()",
140+
time.November.String(): "time.November.String()",
141+
time.December.String(): "time.December.String()",
142+
}
145143

146144
var timeLayout = map[string]string{
147145
time.Layout: "time.Layout",
Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,52 @@
11
package crypto
22

3-
func MD4() {
4-
_ = "MD4" // want `"MD4" can be replaced by crypto.MD4.String\(\)`
3+
import "fmt"
4+
5+
var (
6+
_ = "MD4" // want `"MD4" can be replaced by crypto.MD4.String\(\)`
7+
_ = "MD5" // want `"MD5" can be replaced by crypto.MD5.String\(\)`
8+
_ = "SHA-1" // want `"SHA-1" can be replaced by crypto.SHA1.String\(\)`
9+
_ = "SHA-224" // want `"SHA-224" can be replaced by crypto.SHA224.String\(\)`
10+
_ = "SHA-256" // want `"SHA-256" can be replaced by crypto.SHA256.String\(\)`
11+
_ = "SHA-384" // want `"SHA-384" can be replaced by crypto.SHA384.String\(\)`
12+
_ = "SHA-512" // want `"SHA-512" can be replaced by crypto.SHA512.String\(\)`
13+
_ = "MD5+SHA1" // want `"MD5\+SHA1" can be replaced by crypto.MD5SHA1.String\(\)`
14+
_ = "RIPEMD-160" // want `"RIPEMD-160" can be replaced by crypto.RIPEMD160.String\(\)`
15+
_ = "SHA3-224" // want `"SHA3-224" can be replaced by crypto.SHA3_224.String\(\)`
16+
_ = "SHA3-256" // want `"SHA3-256" can be replaced by crypto.SHA3_256.String\(\)`
17+
_ = "SHA3-384" // want `"SHA3-384" can be replaced by crypto.SHA3_384.String\(\)`
18+
_ = "SHA3-512" // want `"SHA3-512" can be replaced by crypto.SHA3_512.String\(\)`
19+
_ = "SHA-512/224" // want `"SHA-512/224" can be replaced by crypto.SHA512_224.String\(\)`
20+
_ = "SHA-512/256" // want `"SHA-512/256" can be replaced by crypto.SHA512_256.String\(\)`
21+
_ = "BLAKE2s-256" // want `"BLAKE2s-256" can be replaced by crypto.BLAKE2s_256.String\(\)`
22+
_ = "BLAKE2b-256" // want `"BLAKE2b-256" can be replaced by crypto.BLAKE2b_256.String\(\)`
23+
_ = "BLAKE2b-384" // want `"BLAKE2b-384" can be replaced by crypto.BLAKE2b_384.String\(\)`
24+
_ = "BLAKE2b-512" // want `"BLAKE2b-512" can be replaced by crypto.BLAKE2b_512.String\(\)`
25+
)
26+
27+
const (
28+
_ = "MD4" // want `"MD4" can be replaced by crypto.MD4.String\(\)`
29+
_ = "MD5" // want `"MD5" can be replaced by crypto.MD5.String\(\)`
30+
_ = "SHA-1" // want `"SHA-1" can be replaced by crypto.SHA1.String\(\)`
31+
_ = "SHA-224" // want `"SHA-224" can be replaced by crypto.SHA224.String\(\)`
32+
_ = "SHA-256" // want `"SHA-256" can be replaced by crypto.SHA256.String\(\)`
33+
_ = "SHA-384" // want `"SHA-384" can be replaced by crypto.SHA384.String\(\)`
34+
_ = "SHA-512" // want `"SHA-512" can be replaced by crypto.SHA512.String\(\)`
35+
_ = "MD5+SHA1" // want `"MD5\+SHA1" can be replaced by crypto.MD5SHA1.String\(\)`
36+
_ = "RIPEMD-160" // want `"RIPEMD-160" can be replaced by crypto.RIPEMD160.String\(\)`
37+
_ = "SHA3-224" // want `"SHA3-224" can be replaced by crypto.SHA3_224.String\(\)`
38+
_ = "SHA3-256" // want `"SHA3-256" can be replaced by crypto.SHA3_256.String\(\)`
39+
_ = "SHA3-384" // want `"SHA3-384" can be replaced by crypto.SHA3_384.String\(\)`
40+
_ = "SHA3-512" // want `"SHA3-512" can be replaced by crypto.SHA3_512.String\(\)`
41+
_ = "SHA-512/224" // want `"SHA-512/224" can be replaced by crypto.SHA512_224.String\(\)`
42+
_ = "SHA-512/256" // want `"SHA-512/256" can be replaced by crypto.SHA512_256.String\(\)`
43+
_ = "BLAKE2s-256" // want `"BLAKE2s-256" can be replaced by crypto.BLAKE2s_256.String\(\)`
44+
_ = "BLAKE2b-256" // want `"BLAKE2b-256" can be replaced by crypto.BLAKE2b_256.String\(\)`
45+
_ = "BLAKE2b-384" // want `"BLAKE2b-384" can be replaced by crypto.BLAKE2b_384.String\(\)`
46+
_ = "BLAKE2b-512" // want `"BLAKE2b-512" can be replaced by crypto.BLAKE2b_512.String\(\)`
47+
)
48+
49+
func _() {
50+
_ = fmt.Sprint("MD4") // want `"MD4" can be replaced by crypto.MD4.String\(\)`
51+
_ = fmt.Sprint("MD4 is cryptographic hash function")
552
}

0 commit comments

Comments
 (0)