containerd / fifo

fifo pkg for Go
https://containerd.io
Apache License 2.0
85 stars 30 forks source link

run linters on macOS and Windows as well #38

Closed thaJeztah closed 3 years ago

thaJeztah commented 3 years ago

Mostly to catch if we correctly specified build-tags (see https://github.com/containerd/fifo/pull/36)

thaJeztah commented 3 years ago

This will fail currently (until #36 is merged; will rebase after to verify it fixes that in CI)

thaJeztah commented 3 years ago

Arg... more compile errors on Windows;

level=error msg="[linters context] typechecking error: D:\\a\\fifo\\fifo\\src\\github.com\\containerd\\fifo\\handle_nolinux.go:34:19: Stat_t not declared by package syscall"
  level=error msg="[linters context] typechecking error: D:\\a\\fifo\\fifo\\src\\github.com\\containerd\\fifo\\handle_nolinux.go:35:20: Stat not declared by package syscall"
  level=error msg="[linters context] typechecking error: D:\\a\\fifo\\fifo\\src\\github.com\\containerd\\fifo\\mkfifo_nosolaris.go:24:17: Mkfifo not declared by package syscall"
  level=error msg="[linters context] typechecking error: D:\\a\\fifo\\fifo\\src\\github.com\\containerd\\fifo\\raw_test.go:220:27: cannot use int(fd) (value of type int) as syscall.Handle value in argument to syscall.Write"
  level=error msg="[linters context] typechecking error: D:\\a\\fifo\\fifo\\src\\github.com\\containerd\\fifo\\raw_test.go:240:26: cannot use int(fd) (value of type int) as syscall.Handle value in argument to syscall.Read"
  level=warning msg="[runner] Can't run linter goanalysis_metalinter: S1037: failed prerequisites: [(inspect@github.com/containerd/fifo [github.com/containerd/fifo.test], isgenerated@github.com/containerd/fifo [
thaJeztah commented 3 years ago

golangci-lint.. I hate you.. this is absolutely useless; somewhere, some place a file is detected as "not gofmt'ed".. so.. where????

  Running [D:\a\_temp\25b45d69-8406-47bb-b2cb-5dda8cdb0a43\golangci-lint-1.29.0-windows-amd64\golangci-lint run --out-format=github-actions --path-prefix=src/github.com/containerd/fifo] in [D:\a\fifo\fifo\src\github.com\containerd\fifo] ...
  Error: File is not `gofmt`-ed with `-s` (gofmt)
  Error: File is not `gofmt`-ed with `-s` (gofmt)

  Error: issues found
  Ran golangci-lint in 16413ms
mxpv commented 3 years ago

This might be because of line endings. go expects unix line endings on all platforms (https://github.com/golang/go/issues/16355). while github actions git setup does CRLF conversions by default, making golangci-lint to complain (https://github.com/golangci/golangci-lint/issues/580). I did the following fix in containerd repo: https://github.com/containerd/containerd/pull/4609/commits/8b03df2dae14c6ce4159ac9b40022a19d0d9e827

thaJeztah commented 3 years ago

Oh! Thanks! Let me give that a try

thaJeztah commented 3 years ago

That was it! You're a hero! It's green now (with https://github.com/containerd/fifo/pull/39 included, so still as "draft")

thaJeztah commented 3 years ago

https://github.com/containerd/fifo/pull/39 was merged; rebased and moved this out of draft

@mxpv @estesp ptal