Owen Mansel-Chan
1beb348d95
Fix outdated message
2023-05-11 14:29:14 +01:00
Owen Mansel-Chan
02a224c28f
--identify-environment should write json to stdout
2023-05-11 14:29:14 +01:00
Owen Mansel-Chan
9334cfb22c
Change logic when go mod version above max supported version
2023-05-10 21:56:56 +01:00
Owen Mansel-Chan
9c5fc9714a
Use "Requesting" instead of "Writing environment file"
2023-05-10 21:53:10 +01:00
Owen Mansel-Chan
97ec7a07eb
Address review comments
2023-05-10 15:53:08 +01:00
Owen Mansel-Chan
375be68492
Fix diagnostics
2023-05-10 11:12:48 +01:00
Owen Mansel-Chan
edebebf603
Refactor for clarity
2023-05-10 11:12:47 +01:00
Owen Mansel-Chan
12f996ff56
Deal better with goModVersion < minGoVersion
2023-05-10 09:45:48 +01:00
Owen Mansel-Chan
32b5df69c3
Add comments explaining version choice logic
2023-05-10 09:26:18 +01:00
Owen Mansel-Chan
d329da673a
Refactor logic for which version to install
...
This does not change the version returned. In the case the the go mod
version is supported and the go env version is below goMinVersion, the
message now talks about go env version being unsupported instead of
it being less than go mod version. This seems more sensible to me.
2023-05-05 15:44:55 +01:00
Owen Mansel-Chan
3f7a230a11
Sometimes install Go version even when one exists
2023-05-05 15:44:54 +01:00
Owen Mansel-Chan
bb3101e649
Merge pull request #13022 from owen-mc/go/identify-environment-fixes
...
Go: `go-autobuilder --identify-environment` fixes
2023-05-04 14:30:31 +01:00
Owen Mansel-Chan
011c9272cf
Remove inconsistent line break in message
2023-05-04 10:33:05 +01:00
Owen Mansel-Chan
c21b1a6e3b
Be clear when no Go version in environment file
2023-05-04 10:32:21 +01:00
Owen Mansel-Chan
5d06adb1e6
Only check if go env version is supported if go mod version is supported
...
This is what I meant to implement in the first place.
2023-05-04 10:24:43 +01:00
Owen Mansel-Chan
62653fbec5
Simplify return statements in tryReadGoDirective
...
This makes it easier to reason about what is returned and would have
avoided the bug with variable shadowing.
2023-05-03 16:55:19 +01:00
Owen Mansel-Chan
d30b736eb2
Move check for EmitNewerGoVersionNeeded diagnostic
...
This should only be done when --identify-environment has not been passed
2023-05-03 16:52:48 +01:00
Owen Mansel-Chan
afb692300a
Fix typo in field name
2023-05-03 16:46:44 +01:00
Owen Mansel-Chan
742a6d9264
Fix accidental variable shadowing
2023-05-03 16:32:53 +01:00
Owen Mansel-Chan
347b5f1b1a
Remove unused code
2023-05-03 16:03:17 +01:00
Owen Mansel-Chan
509dda5af5
Use raw string literals to avoid double-escaping
2023-05-03 16:02:36 +01:00
Owen Mansel-Chan
841db151f6
Improve naming
2023-05-03 13:01:23 +01:00
Owen Mansel-Chan
0f134c6a3c
Wrap long line
2023-05-03 12:52:11 +01:00
Owen Mansel-Chan
f86e540d2a
msg is always non-empty
2023-05-03 12:50:58 +01:00
Owen Mansel-Chan
af2a9b21ab
Add function comments
2023-05-03 12:47:28 +01:00
Owen Mansel-Chan
4b88279ccc
Improve usage message formatting
2023-05-03 12:03:11 +01:00
Owen Mansel-Chan
27fb42db76
Env var for path to environment file
2023-05-03 11:11:09 +01:00
Owen Mansel-Chan
0c6efb8c84
Add telemetry-only diagnostics
2023-05-02 17:17:06 +01:00
Owen Mansel-Chan
0710ed97db
Refactor to be more easily testable
2023-05-02 17:17:05 +01:00
Owen Mansel-Chan
2db304edee
Choose which version to install and write file
2023-05-02 17:17:04 +01:00
Owen Mansel-Chan
644d7f18c2
Factor out tryReadGoDirective()
2023-05-02 14:15:03 +01:00
Owen Mansel-Chan
5e87111a8b
Stop using deprecate io/ioutil package
2023-05-02 14:15:02 +01:00
Owen Mansel-Chan
1e2bdd88b1
Add --identify-environment flag
2023-05-02 14:15:01 +01:00
Owen Mansel-Chan
1afe845ed3
Add missing "v" to semver version string
...
Because it was missing, that function always returned +1,
so we were doing the wrong thing when the Go version
installed was lower than 1.16.
2023-04-24 14:31:46 +01:00
Owen Mansel-Chan
3ca04338ca
Use named initialization for struct
2023-04-19 13:06:51 +01:00
Owen Mansel-Chan
219c1686fd
Wrap return values of moveToTemporaryGopath in a struct
2023-04-19 12:40:23 +01:00
Owen Mansel-Chan
1bb006f43e
Move defer statements to the right place
...
It turns out that extracting defer statements into a separate function
changes behaviour.
2023-04-19 12:20:52 +01:00
Owen Mansel-Chan
641f16b0df
Factor out extract()
2023-04-19 12:20:52 +01:00
Owen Mansel-Chan
a611769b43
Factor out installDependencies()
2023-04-19 12:20:51 +01:00
Owen Mansel-Chan
d61d595b21
Factor out function buildWithCustomCommands
2023-04-19 12:20:51 +01:00
Owen Mansel-Chan
b45c0ff848
Factor out buildWithoutCustomCommands
2023-04-19 12:20:51 +01:00
Owen Mansel-Chan
b76e655735
Factor out moving code to temp dir in gopath
2023-04-19 12:20:50 +01:00
Owen Mansel-Chan
ba48eaa8a6
Factor out calculation of source dir
2023-04-19 12:20:50 +01:00
Owen Mansel-Chan
702c22b630
Refactor calculation of inLGTM
2023-04-19 12:20:49 +01:00
Owen Mansel-Chan
f0186957ca
Factor out tryUpdateGoModAndGoSum
2023-04-19 12:20:49 +01:00
Owen Mansel-Chan
0bfb242e63
Factor out logic for needGopath
2023-04-19 12:20:49 +01:00
Owen Mansel-Chan
b169f1bfdf
Factor out code to fix go vendor issues
2023-04-19 12:20:48 +01:00
Owen Mansel-Chan
f872a11b85
Factor out initial ModMode calculation
2023-04-19 12:20:48 +01:00
Owen Mansel-Chan
2d8d9773c4
Factor out depMode calculation
2023-04-19 12:20:47 +01:00
Owen Mansel-Chan
4907e5754f
Address review comments
2023-03-07 16:38:49 +00:00