livebud / bud

The Full-Stack Web Framework for Go
MIT License
5.53k stars 182 forks source link

build: support Go v1.20 and add to CI checks #378

Closed wheinze closed 1 year ago

wheinze commented 1 year ago

Add support for Go 1.20 to GitHub action.

matthewmueller commented 1 year ago

Thanks for helping with this @wheinze! Do you have any idea what's going on with the failures?

wheinze commented 1 year ago

Thanks for helping with this @wheinze!

You're welcome :) Didn't expect these kind of errors though, and had no time to continue digging deeper into yet.

Do you have any idea what's going on with the failures?

No, unfortunately not in detail yet. @matthewmueller Do you have any?

My journey so far:

  1. Quoting of Go version in github action The rationale behind it is, that I had issues with the github action not recognizing Go 1.20 properly: image

https://github.com/livebud/bud/actions/runs/4129857452/jobs/7135927257

  1. staticcheck-related errors The errors that can be seen in the github action logs, at least for me, seem to be related to staticcheck. There might be some incompatibility in this context with Go 1.20.

I ran make ci.ubuntu on a linux machine locally and as I noticed that this behavior can be reproduced locally, I commented out the staticcheck part in the Makefile what proved to me that it is related to staticcheck as those error were gone then, but tests are failing.

  1. Failing tests

make ci.ubuntu

  qs/parse
    ✔ empty
    ✔ name&species
    ✔ name=false
    ✔ name=tobi&species=ferret
    ✔ ?names=friends+and+family
    ✔ ?name=tobi&species=ferret
    ✔ items=1&items=2&items=3&key=a

  7 passing (3ms)

?       github.com/livebud/bud/internal/ansi    [no test files]
?       github.com/livebud/bud/internal/bail    [no test files]
?       github.com/livebud/bud/internal/dsync/set   [no test files]
?       github.com/livebud/bud/internal/embed   [no test files]
?       github.com/livebud/bud/internal/embedded    [no test files]
?       github.com/livebud/bud/internal/esmeta  [no test files]
?       github.com/livebud/bud/internal/gois    [no test files]
?       github.com/livebud/bud/internal/prompter    [no test files]
?       github.com/livebud/bud/internal/scaffold    [no test files]
?       github.com/livebud/bud/internal/stacktrace  [no test files]
?       github.com/livebud/bud/internal/testcli [no test files]
?       github.com/livebud/bud/package/finder   [no test files]
?       github.com/livebud/bud/package/js   [no test files]
?       github.com/livebud/bud/package/log  [no test files]
?       github.com/livebud/bud/package/log/levelfilter  [no test files]
?       github.com/livebud/bud/package/log/logfmt   [no test files]
?       github.com/livebud/bud/package/log/multi    [no test files]
?       github.com/livebud/bud/package/log/ndjson   [no test files]
?       github.com/livebud/bud/package/log/testlog  [no test files]
?       github.com/livebud/bud/package/scaffold [no test files]
?       github.com/livebud/bud/framework/afs    [no test files]
?       github.com/livebud/bud/framework/afs/afsrt  [no test files]
?       github.com/livebud/bud/framework/controller/controllerrt/response   [no test files]
?       github.com/livebud/bud/framework/public/publicrt    [no test files]
?       github.com/livebud/bud/framework/view/nodemodules   [no test files]
?       github.com/livebud/bud/framework/view/viewrt    [no test files]
?       github.com/livebud/bud/framework/web/welcome    [no test files]
ok      github.com/livebud/bud/internal/cli 41.306s
ok      github.com/livebud/bud/internal/current (cached)
ok      github.com/livebud/bud/internal/dag (cached)
ok      github.com/livebud/bud/internal/dag2    (cached)
ok      github.com/livebud/bud/internal/dirhash (cached)
ok      github.com/livebud/bud/internal/dsync   (cached)
ok      github.com/livebud/bud/internal/entrypoint  (cached)
ok      github.com/livebud/bud/internal/envs    (cached)
ok      github.com/livebud/bud/internal/errs    (cached)
ok      github.com/livebud/bud/internal/extrafile   0.011s
ok      github.com/livebud/bud/internal/gitignore   (cached)
ok      github.com/livebud/bud/internal/glob    (cached)
ok      github.com/livebud/bud/internal/gotemplate  (cached)
ok      github.com/livebud/bud/internal/imports (cached)
ok      github.com/livebud/bud/internal/is  (cached)
ok      github.com/livebud/bud/internal/mergefs (cached)
ok      github.com/livebud/bud/internal/npm (cached)
ok      github.com/livebud/bud/internal/once    (cached)
ok      github.com/livebud/bud/internal/orderedset  (cached)
ok      github.com/livebud/bud/internal/printfs (cached)
ok      github.com/livebud/bud/internal/pubsub  (cached)
ok      github.com/livebud/bud/internal/shell   (cached)
ok      github.com/livebud/bud/internal/sig (cached)
ok      github.com/livebud/bud/internal/snapshot    (cached)
ok      github.com/livebud/bud/internal/targz   (cached)
ok      github.com/livebud/bud/internal/testdir 7.949s
ok      github.com/livebud/bud/internal/testsub (cached)
ok      github.com/livebud/bud/internal/txtar   (cached)
ok      github.com/livebud/bud/internal/urlx    (cached)
ok      github.com/livebud/bud/internal/valid   (cached)
ok      github.com/livebud/bud/internal/versions    0.041s
ok      github.com/livebud/bud/package/budhttp  4.408s
ok      github.com/livebud/bud/package/budhttp/budsvr   (cached)
ok      github.com/livebud/bud/package/commander    (cached)
ok      github.com/livebud/bud/package/di   14.048s
ok      github.com/livebud/bud/package/genfs    0.048s
ok      github.com/livebud/bud/package/gomod    0.071s
ok      github.com/livebud/bud/package/hot  (cached)
ok      github.com/livebud/bud/package/js/v8    (cached)
ok      github.com/livebud/bud/package/log/console  (cached)
ok      github.com/livebud/bud/package/log/memory   (cached)
ok      github.com/livebud/bud/package/middleware   (cached)
ok      github.com/livebud/bud/package/modcache 0.028s
ok      github.com/livebud/bud/package/parser   0.193s
ok      github.com/livebud/bud/package/pluginmod    0.108s
ok      github.com/livebud/bud/package/remotefs (cached)
ok      github.com/livebud/bud/package/router   (cached)
ok      github.com/livebud/bud/package/router/lex   (cached)
ok      github.com/livebud/bud/package/router/radix (cached)
ok      github.com/livebud/bud/package/socket   (cached)
ok      github.com/livebud/bud/package/svelte   (cached)
ok      github.com/livebud/bud/package/vfs  (cached)
ok      github.com/livebud/bud/package/virtual  (cached)
ok      github.com/livebud/bud/package/watcher  (cached)
ok      github.com/livebud/bud/framework    (cached)
ok      github.com/livebud/bud/framework/app    2.758s
ok      github.com/livebud/bud/framework/controller 91.425s
ok      github.com/livebud/bud/framework/controller/controllerrt/request    (cached)
# app.com/generator/tailwind
generator/tailwind/tailwind.go:8:4: "ok" (untyped string constant) is not used
generator/tailwind/tailwind.go:9:3: missing return
generator_test.go:184: exit status 2 not in exit status 1
--- FAIL: TestSyntaxError (0.28s)
FAIL
FAIL    github.com/livebud/bud/framework/generator  8.684s
ok      github.com/livebud/bud/framework/public 15.646s
ok      github.com/livebud/bud/framework/transform/transformrt  0.043s
ok      github.com/livebud/bud/framework/transpiler 15.849s
ok      github.com/livebud/bud/framework/view   30.724s
ok      github.com/livebud/bud/framework/view/dom   4.214s
ok      github.com/livebud/bud/framework/view/ssr   3.447s
ok      github.com/livebud/bud/framework/web    2.949s
ok      github.com/livebud/bud/framework/web/webrt  (cached)
FAIL
make: *** [Makefile:74: go.test] Error 1

I'm not deep into that part of the codebase right now, so I would start digging around once time allows me to :)

@matthewmueller Can you reproduce this on your side (macOS, if I remember correctly) as well? (Assuming you already did upgrade to Go 1.20 locally)

matthewmueller commented 1 year ago

I haven't yet upgraded. A bit of a slow adopter 😅 I'll give upgrading a try this coming weekend.

Unfortunately not sure what the error is and was hoping you knew 😄

On Fri, Feb 10, 2023 at 11:48 AM Waldemar Heinze @.***> wrote:

Thanks for helping with this @wheinze https://github.com/wheinze!

You're welcome :) Didn't expect these kind of errors though, and had no time to continue digging deeper into yet.

Do you have any idea what's going on with the failures?

No, unfortunately not in detail yet. @matthewmueller https://github.com/matthewmueller Do you have any?

My journey so far:

  1. Quoting of Go version in github action The rationale behind it is, that I had issues with the github action not recognizing Go 1.20 properly: [image: image] https://user-images.githubusercontent.com/1307809/218145053-1b5a7be5-825e-4ba3-a384-61aae572a87a.png

https://github.com/livebud/bud/actions/runs/4129857452/jobs/7135927257

  1. staticcheck-related errors The errors that can be seen in the github action logs, at least for me, seem to be related to staticcheck. There might be some incompatibility in this context with Go 1.20.

I ran make ci.ubuntu on a linux machine locally and as I noticed that this behavior can be reproduced locally, I commented out the staticcheck part in the Makefile what proved to me that it is related to staticcheck as those error were gone then, but tests are failing.

  1. Failing tests

make ci.ubuntu

qs/parse

✔ empty

✔ name&species

✔ name=false

✔ name=tobi&species=ferret

✔ ?names=friends+and+family

✔ ?name=tobi&species=ferret

✔ items=1&items=2&items=3&key=a

7 passing (3ms)

? github.com/livebud/bud/internal/ansi [no test files]

? github.com/livebud/bud/internal/bail [no test files]

? github.com/livebud/bud/internal/dsync/set [no test files]

? github.com/livebud/bud/internal/embed [no test files]

? github.com/livebud/bud/internal/embedded [no test files]

? github.com/livebud/bud/internal/esmeta [no test files]

? github.com/livebud/bud/internal/gois [no test files]

? github.com/livebud/bud/internal/prompter [no test files]

? github.com/livebud/bud/internal/scaffold [no test files]

? github.com/livebud/bud/internal/stacktrace [no test files]

? github.com/livebud/bud/internal/testcli [no test files]

? github.com/livebud/bud/package/finder [no test files]

? github.com/livebud/bud/package/js [no test files]

? github.com/livebud/bud/package/log [no test files]

? github.com/livebud/bud/package/log/levelfilter [no test files]

? github.com/livebud/bud/package/log/logfmt [no test files]

? github.com/livebud/bud/package/log/multi [no test files]

? github.com/livebud/bud/package/log/ndjson [no test files]

? github.com/livebud/bud/package/log/testlog [no test files]

? github.com/livebud/bud/package/scaffold [no test files]

? github.com/livebud/bud/framework/afs [no test files]

? github.com/livebud/bud/framework/afs/afsrt [no test files]

? github.com/livebud/bud/framework/controller/controllerrt/response [no test files]

? github.com/livebud/bud/framework/public/publicrt [no test files]

? github.com/livebud/bud/framework/view/nodemodules [no test files]

? github.com/livebud/bud/framework/view/viewrt [no test files]

? github.com/livebud/bud/framework/web/welcome [no test files]

ok github.com/livebud/bud/internal/cli 41.306s

ok github.com/livebud/bud/internal/current (cached)

ok github.com/livebud/bud/internal/dag (cached)

ok github.com/livebud/bud/internal/dag2 (cached)

ok github.com/livebud/bud/internal/dirhash (cached)

ok github.com/livebud/bud/internal/dsync (cached)

ok github.com/livebud/bud/internal/entrypoint (cached)

ok github.com/livebud/bud/internal/envs (cached)

ok github.com/livebud/bud/internal/errs (cached)

ok github.com/livebud/bud/internal/extrafile 0.011s

ok github.com/livebud/bud/internal/gitignore (cached)

ok github.com/livebud/bud/internal/glob (cached)

ok github.com/livebud/bud/internal/gotemplate (cached)

ok github.com/livebud/bud/internal/imports (cached)

ok github.com/livebud/bud/internal/is (cached)

ok github.com/livebud/bud/internal/mergefs (cached)

ok github.com/livebud/bud/internal/npm (cached)

ok github.com/livebud/bud/internal/once (cached)

ok github.com/livebud/bud/internal/orderedset (cached)

ok github.com/livebud/bud/internal/printfs (cached)

ok github.com/livebud/bud/internal/pubsub (cached)

ok github.com/livebud/bud/internal/shell (cached)

ok github.com/livebud/bud/internal/sig (cached)

ok github.com/livebud/bud/internal/snapshot (cached)

ok github.com/livebud/bud/internal/targz (cached)

ok github.com/livebud/bud/internal/testdir 7.949s

ok github.com/livebud/bud/internal/testsub (cached)

ok github.com/livebud/bud/internal/txtar (cached)

ok github.com/livebud/bud/internal/urlx (cached)

ok github.com/livebud/bud/internal/valid (cached)

ok github.com/livebud/bud/internal/versions 0.041s

ok github.com/livebud/bud/package/budhttp 4.408s

ok github.com/livebud/bud/package/budhttp/budsvr (cached)

ok github.com/livebud/bud/package/commander (cached)

ok github.com/livebud/bud/package/di 14.048s

ok github.com/livebud/bud/package/genfs 0.048s

ok github.com/livebud/bud/package/gomod 0.071s

ok github.com/livebud/bud/package/hot (cached)

ok github.com/livebud/bud/package/js/v8 (cached)

ok github.com/livebud/bud/package/log/console (cached)

ok github.com/livebud/bud/package/log/memory (cached)

ok github.com/livebud/bud/package/middleware (cached)

ok github.com/livebud/bud/package/modcache 0.028s

ok github.com/livebud/bud/package/parser 0.193s

ok github.com/livebud/bud/package/pluginmod 0.108s

ok github.com/livebud/bud/package/remotefs (cached)

ok github.com/livebud/bud/package/router (cached)

ok github.com/livebud/bud/package/router/lex (cached)

ok github.com/livebud/bud/package/router/radix (cached)

ok github.com/livebud/bud/package/socket (cached)

ok github.com/livebud/bud/package/svelte (cached)

ok github.com/livebud/bud/package/vfs (cached)

ok github.com/livebud/bud/package/virtual (cached)

ok github.com/livebud/bud/package/watcher (cached)

ok github.com/livebud/bud/framework (cached)

ok github.com/livebud/bud/framework/app 2.758s

ok github.com/livebud/bud/framework/controller 91.425s

ok github.com/livebud/bud/framework/controller/controllerrt/request (cached)

app.com/generator/tailwind

generator/tailwind/tailwind.go:8:4: "ok" (untyped string constant) is not used

generator/tailwind/tailwind.go:9:3: missing return

generator_test.go:184: exit status 2 not in exit status 1

--- FAIL: TestSyntaxError (0.28s)

FAIL

FAIL github.com/livebud/bud/framework/generator 8.684s

ok github.com/livebud/bud/framework/public 15.646s

ok github.com/livebud/bud/framework/transform/transformrt 0.043s

ok github.com/livebud/bud/framework/transpiler 15.849s

ok github.com/livebud/bud/framework/view 30.724s

ok github.com/livebud/bud/framework/view/dom 4.214s

ok github.com/livebud/bud/framework/view/ssr 3.447s

ok github.com/livebud/bud/framework/web 2.949s

ok github.com/livebud/bud/framework/web/webrt (cached)

FAIL

make: *** [Makefile:74: go.test] Error 1

I'm not deep into that part of the codebase right now, so I would start digging around once time allows me to :)

@matthewmueller https://github.com/matthewmueller Can you reproduce this on your side (macOS, if I remember correctly) as well? (Assuming you already did upgrade to Go 1.20 locally)

— Reply to this email directly, view it on GitHub https://github.com/livebud/bud/pull/378#issuecomment-1426074291, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABJSO4ZBAJHABAO4Q6K45LWWZWOZANCNFSM6AAAAAAUV5WJQE . You are receiving this because you were mentioned.Message ID: @.***>

wheinze commented 1 year ago

Nope :laughing: , but we'll make it ;)

staticcheck issues seem to be resolved by using the proper released version of it, as stated per docs. I changed it and those issues related to staticcheck combined wiith Go 1.20 do not appear anymore, resulting in the same issues with the failing tests now: https://github.com/livebud/bud/actions/runs/4171476823/jobs/7221455414

The drawback here seems to be, that older Go versions are not supported anymore:

staticcheck requires at least Go 1.19. Which brings me to the question if we should also lift requirements for bud, or differentiate on this in CI and use older versions of staticcheck for Go <1.19. @matthewmueller What do you think?

As updating your global Go version, most likely, will break your local env as well, you might consider giving asdf-vm a shot. I provided a PR for main with Go 1.19 and would add a proper .tool-versions file here.

matthewmueller commented 1 year ago

Progress! I'd personally like to keep older Go versions working over time. I have been considering adopting generics in Bud which would bump it up to 1.18, but that seems like a worthwhile reason when the time comes.

It looks like we can target specific versions of Go with: https://staticcheck.io/docs/running-staticcheck/cli/#go. Maybe we can bump staticcheck, but then use the --go flag to swap the checks depending on which Go version is running in CI?

wheinze commented 1 year ago

Progress! I'd personally like to keep older Go versions working over time. I have been considering adopting generics in Bud which would bump it up to 1.18, but that seems like a worthwhile reason when the time comes.

Fair point! Yep, we should not bump Bud's requirements because of the used tooling that demands it , but rather only do this when needed for Bud itself :+1:

It looks like we can target specific versions of Go with: https://staticcheck.io/docs/running-staticcheck/cli/#go. Maybe we can bump staticcheck, but then use the --go flag to swap the checks depending on which Go version is running in CI?

Nice catch! As staticcheck provides a GitHub action, I used that one to integrate more native into GtHub's CI. The action also differentiates on the version of staticcheck that is used as they only support the last two Go versions with a release. The staticcheck job runs fine with this approach ;)

matthewmueller commented 1 year ago

Merged. Thanks so much for your continued help @wheinze!