Skip to content

🐞 Incompatible fsutil version in go sdk #3367

Closed

Description

@kpenfound

What is the issue?

Using the Go sdk on:

go version
go version go1.19.1 darwin/arm64

When I upgrade to the latest version of the go sdk:

go get -u go.dagger.io/dagger@d988bac
go: downloading go.dagger.io/dagger v0.2.35-0.20221013212912-d988bac25577
go: downloading golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43
go: downloading google.golang.org/genproto v0.0.0-20221013201013-33fc6f83cba4
go: added github.com/moby/patternmatcher v0.5.0
go: upgraded github.com/tonistiigi/fsutil v0.0.0-20220115021204-b19f7f9cb274 => v0.0.0-20220930225714-4638ad635be5
go: upgraded go.dagger.io/dagger v0.2.35-0.20221012231743-405b55e9157c => v0.2.35-0.20221013212912-d988bac25577
go: upgraded golang.org/x/sys v0.0.0-20221010170243-090e33056c14 => v0.0.0-20221013171732-95e765b1cc43
go: upgraded google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e => v0.0.0-20221013201013-33fc6f83cba4

Go upgrades me to fsutil v0.0.0-20220115021204-b19f7f9cb274. When I run engine.Start while on this version of fsutil, dagger says:

go run ci/main.go test
# github.com/moby/buildkit/session/filesync
../../../../go/1.19.1/pkg/mod/github.com/moby/[email protected]/session/filesync/filesync.go:112:20: cannot use dir.Map (variable of type func(string, *types.Stat) bool) as type fsutil.MapFunc in struct literal

When I rollback fsutil:

go get github.com/tonistiigi/fsutil@b19f7f9cb274
go: downgraded github.com/tonistiigi/fsutil v0.0.0-20220930225714-4638ad635be5 => v0.0.0-20220115021204-b19f7f9cb274

I'm able to successfully start the engine

Log output

No response

Steps to reproduce

No response

Dagger version

d988bac

OS version

macOS arm64

Activity

  1. added
    kind/bug
    on Oct 13, 2022
  2. sipsma commented on Oct 13, 2022

    @sipsma
    Contributor

    Can reproduce this and the error makes sense in that there was indeed an incompatible change here: https://github.com/tonistiigi/fsutil/blame/4638ad635be52e38af6b57952a7a5d3f938704a7/walker.go#L25

    What makes less sense to me is that the change in question happened 5 months ago, so I don't really get why this would not have appeared earlier.

    dagger's dep on fsutil got moved from //indirect to direct by my recent change (though I did not do that by hand, it must have happened automatically): https://github.com/dagger/dagger/blame/cloak/go.mod#L25

    • I have no idea if that's related, it didn't change the version, will poke a bit more though

    If that leads nowhere I'll think about what options we can give users in the mean time while this issue is sorted out. We can ask them to downgrade fsutil of course, but that's far from ideal, so I'll see if there's anything else

  3. jpadams commented on Oct 13, 2022

    @jpadams
    Contributor

    Confirmed almost identical error message on
    go version go1.19 darwin/arm64 and go version go1.18.2 darwin/arm64

    # github.com/moby/buildkit/session/filesync
    ../../../../../go/pkg/mod/github.com/moby/[email protected]/session/filesync/filesync.go:112:20: cannot use dir.Map (variable of type func(string, *types.Stat) bool) as type fsutil.MapFunc in struct literal
    
  4. sipsma commented on Oct 13, 2022

    @sipsma
    Contributor

    @kpenfound I think the solution to this will be to just not include -u when running go get. After poking around more I think that's more meant for when you as a maintainer are trying to actually update everything (including transitive) deps to the latest version (and accepting any problems that may cause). Normal use of just adding a dependency should not include it.

    If I start from an empty go mod and run these commands (with code that imports the api in my dir):

    go get go.dagger.io/dagger@d988bac // no -u
    go mod edit -replace=github.com/docker/docker=github.com/docker/[email protected]+incompatible
    go mod tidy

    Then it all works for me.

    The problem in general will be fixed when we upgrade to a new buildkit release (their master branch already has been updated for the incompatible change in fsutil).

    Let me know if that works for you too.

  5. jpadams commented on Oct 13, 2022

    @jpadams
    Contributor

    Above fix works for me. Sounds like once we have the new buildkit release (wonder when they'll cut a release?) and we release our go SDK, will be just:

    go mod init <your module>
    go get go.dagger.io/dagger
    go mod tidy
    

    right?

  6. sipsma commented on Oct 14, 2022

    @sipsma
    Contributor

    Above fix works for me. Sounds like once we have the new buildkit release (wonder when they'll cut a release?) and we release our go SDK, will be just:

    Well we'll still need the go mod edit command unless something changes. That's a different problem from the one in this issue (has existed for a long time).

    But yeah once we merge into main I don't think we'll need the @<commit> anymore at least.

  7. thaJeztah commented on Oct 14, 2022

    @thaJeztah
  8. sipsma commented on Oct 14, 2022

    @sipsma
    Contributor

    Thanks @thaJeztah ! Actually, while you're here, do you know if there's any hope for the replace of github.com/docker/docker to be removed from buildkit's go.mod in the future?

    Either way @jpadams @kpenfound looks like the fsutil incompatibility will be backported to a v0.10 release. However, I would still in general recommend we don't tell users to use -u just because other similar problems could crop up in the future.

  9. thaJeztah commented on Oct 14, 2022

    @thaJeztah

    I think for the replace to be gone, we'd need moby/buildkit#3173 as well (but go modules may still reject the version)

    Currently it looks like neither of those patches will be accepted by the BuildKit maintainers, so if you depend on both BuildKit and Docker, then it's quite possibly things won't work out 😔

  10. sipsma commented on Oct 14, 2022

    @sipsma
    Contributor

    @thaJeztah I see, thanks for the info! It's sad but also just one of those things where the go tooling should really have a better solution (but I'm sure it's complicated and all that).

  11. jpadams commented on Oct 14, 2022

    @jpadams
    Contributor

    @shykes feels like this would be a good place for a sugary cli command like:

    dagger project init foo --sdk go
    

    that would perform

    go mod init foo
    go get go.dagger.io/dagger@<version if needed>
    go mod edit -replace=github.com/docker/docker=github.com/docker/[email protected]+incompatible
    go mod tidy
    
  12. sipsma commented on Oct 14, 2022

    @sipsma
    Contributor

    @jpadams project init is only needed when writing extensions, but agree that as long as we are careful with user's config files (go.mod, package.json, etc.) that would be great to have. Can have a --sugar-free flag for when they don't want it too maybe.

    I could have sworn we had an issue about project init templates (which is kind of similar-ish) but can't find it, so I made a new one here: #3368

  13. kpenfound commented on Oct 14, 2022

    @kpenfound
    ContributorAuthor

    Confirmed that ditching the -u is what I needed, thanks @sipsma

    go get go.dagger.io/dagger@cf8c214
    go: downloading go.dagger.io/dagger v0.2.35-0.20221014150559-cf8c214ae5ae
    go: upgraded go.dagger.io/dagger v0.2.35-0.20221013212912-d988bac25577 => v0.2.35-0.20221014150559-cf8c214ae5ae
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions