@@ -18,15 +18,22 @@ const modVersionRe = /github.com\/golangci\/golangci-lint\s(v\S+)/
18
18
19
19
const parseVersion = ( s : string ) : Version => {
20
20
if ( s == "latest" || s == "" ) {
21
- // TODO(ldez): it should be replaced with an explicit version (ex: v1.64.0)
22
- return null
21
+ // TODO(ldez): v2: it should be replaced with "return null"
22
+ return { major : 1 , minor : 64 , patch : 7 }
23
23
}
24
24
25
25
const match = s . match ( versionRe )
26
26
if ( ! match ) {
27
27
throw new Error ( `invalid version string '${ s } ', expected format v1.2 or v1.2.3` )
28
28
}
29
29
30
+ // TODO(ldez): v2: to remove.
31
+ if ( parseInt ( match [ 1 ] ) > 1 ) {
32
+ throw new Error (
33
+ `invalid version string '${ s } ', golangci-lint v2 is not supported by golangci-lint-action v6, you must update to golangci-lint-action v7.`
34
+ )
35
+ }
36
+
30
37
return {
31
38
major : parseInt ( match [ 1 ] ) ,
32
39
minor : parseInt ( match [ 2 ] ) ,
@@ -115,7 +122,6 @@ const fetchVersionMapping = async (): Promise<VersionMapping> => {
115
122
maxRetries : 5 ,
116
123
} )
117
124
try {
118
- // TODO(ldez): HEAD should be replaced with an explicit version (ex: v1.64.0).
119
125
const url = `https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/assets/github-action-config-v1.json`
120
126
const response : httpm . HttpClientResponse = await http . get ( url )
121
127
if ( response . message . statusCode !== 200 ) {
@@ -134,8 +140,13 @@ export async function getVersion(mode: InstallMode): Promise<VersionInfo> {
134
140
135
141
if ( mode == InstallMode . GoInstall ) {
136
142
const v : string = core . getInput ( `version` )
137
- // TODO(ldez): latest should be replaced with an explicit version (ex: v1.64.0).
138
- return { TargetVersion : v ? v : "latest" }
143
+ // TODO(ldez): v2: to remove.
144
+ if ( v == "latest" ) {
145
+ return { TargetVersion : "v1.64.7" }
146
+ }
147
+
148
+ // TODO(ldez): v2: "v1.64.7" should be replaced with "latest".
149
+ return { TargetVersion : v ? v : "v1.64.7" }
139
150
}
140
151
141
152
const reqVersion = getRequestedVersion ( )
0 commit comments