Skip to content
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

Fix CI on Windows #1395

Closed
wants to merge 17 commits into from
Closed

Conversation

Nivl
Copy link
Contributor

@Nivl Nivl commented Sep 25, 2020

Status: We need someone with a Windows machine to help to debug. I'll try again once parallels support Silicon processors, or if/when Microsoft changes their licensing around Windows on ARM

Closes #1382

There are several issues:

  • gofmt failing on crlf
  • ..\golangci-lint doesn't seems to be installed so all the linter tests fail
  • skip_files_test.go:36
   processor_test.go:50: 
        	Error Trace:	processor_test.go:50
        	            				skip_files_test.go:36
        	Error:      	Should be empty, but was [{   [] <nil> <nil> <nil> a/b/c.go 0 false }]
        	Test:       	TestSkipFiles

@Nivl Nivl changed the title Ignore crlf on windows Fix Windows Sep 25, 2020
@Nivl Nivl changed the title Fix Windows Fix CI on Windows Sep 25, 2020
@Nivl Nivl force-pushed the ml/fix/ci/windows-attribute branch from b43f388 to b7c5e90 Compare September 26, 2020 06:20
@Nivl
Copy link
Contributor Author

Nivl commented Sep 26, 2020

@golangci/team anyone here with a Windows computer that can run some tests? Basically, most of the tests are failing because the golangci-lint binary is not found. Maybe the path is wrong, maybe something needs a .exe somewhere (like make or golangci-lint itself), etc. But it's a pain to try to debug by pushing experiments to the CI. Can someone run make build and show me the output as well as making sure the binary is where we expect it to be and is named the way we expect it to be named (and does it needs to be make.exe)?

@daixiang0
Copy link
Contributor

@Nivl traivs CI support debug mode, you can try it.

@Nivl
Copy link
Contributor Author

Nivl commented Oct 3, 2020

@daixiang0 That's a good idea, thanks. It just sucks because that would require setting up a new CI 😕 I'm gonna wait a bit longer in case someone shows up with a Windows computer 🤞

@Nivl
Copy link
Contributor Author

Nivl commented Jan 2, 2021

I installed Windows on my mac earlier today, so I did a few tests:

The CI fails with:

    testshared.go:118: can't get error code from exec: "..\\golangci-lint": file does not exist
level=info msg="[test] ran [..\\golangci-lint linters -c C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\golangci_lint_test042139755.yml --verbose --fast] in 999.1µs"
    testshared.go:77: 
        	Error Trace:	testshared.go:77
        	            				enabled_linters_test.go:190
        	Error:      	"exec: \"..\\\\golangci-lint\": file does not exist" does not contain "Active 8 linters: [deadcode errcheck gosimple ineffassign staticcheck structcheck typecheck varcheck]"
        	Test:       	TestEnabledLinters
        	Messages:   	exit code is -1

The good thing is that I get the same error locally. The bad thing now is that the file does exist. I tried to change the path from relative to absolute, but it still fails saying the binary doesn't exist, even though I can run ls on the path with no problem.

I don't really have much time to dig deeper for now, but maybe for some reason the path we provide is not being treated as a path, and Go/Windows is looking for a binary named ../golangci-lint rather than for a binary named golangci-lint that is in the parent directory. but that's just a wild guess for now.

@ldez
Copy link
Member

ldez commented Jan 2, 2021

The implementation of Cmd.CombinedOutput/Cmd.Run/Cmd.Start on Windows have some constraints:

https://github.com/golang/go/blob/3dd58676054223962cd915bb0934d1f9f489d4d2/src/os/exec/lp_windows.go#L37-L52

In short, the executable must have an extension (.com, .exe, .bat, .cmd)

https://github.com/golang/go/blob/3dd58676054223962cd915bb0934d1f9f489d4d2/src/os/exec/lp_windows.go#L74

@Nivl
Copy link
Contributor Author

Nivl commented Jan 3, 2021

@ldez Good catch, it's not even documented afaik!

@Nivl
Copy link
Contributor Author

Nivl commented Jan 3, 2021

Thanks @ldez that did solve the issue, sadly now there are 20k more 😀. Some issues around differences in how Windows deals with file descriptors, some because we have hardcoded / everywhere in the tests, etc. Nothing that looks too complicated, I'll try to give it another look by EOM.

@ldez
Copy link
Member

ldez commented Jan 3, 2021

@Nivl I recommend using filepath.FromSlash

@ldez ldez added area: ci PR that update CI platform: windows Issue that is related to Windows labels Feb 19, 2021
@stale
Copy link

stale bot commented Mar 30, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale No recent correspondence or work activity label Mar 30, 2022
@stale stale bot closed this Apr 29, 2022
@ldez
Copy link
Member

ldez commented Aug 24, 2022

@Nivl take a look to #3134 😉

@Nivl Nivl deleted the ml/fix/ci/windows-attribute branch August 24, 2022 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ci PR that update CI platform: windows Issue that is related to Windows stale No recent correspondence or work activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI is failing (silently) on Windows
3 participants