goadesign / goa

🌟 Goa: Elevate Go API development! 🚀 Streamlined design, automatic code generation, and seamless HTTP/gRPC support. ✨
https://goa.design
MIT License
5.67k stars 559 forks source link

Upstream indirect dependency change #3309

Closed dnapier closed 1 year ago

dnapier commented 1 year ago

The output of go mod tidy on a program which imports the dsl package produces this output:

go: finding module for package github.com/jtolds/gls
go: found github.com/jtolds/gls in github.com/jtolds/gls v4.20.0+incompatible
go: found github.com/smartystreets/assertions in github.com/smartystreets/assertions v1.15.0
go: <redacted> imports
        goa.design/goa/v3/dsl imports
        goa.design/goa/v3/expr imports
        github.com/zach-klippenstein/goregen tested by
        github.com/zach-klippenstein/goregen.test imports
        github.com/smartystreets/goconvey/convey imports
        github.com/smartystreets/assertions: github.com/smartystreets/assertions@v1.15.0: parsing go.mod:
        module declares its path as: github.com/smarty/assertions
                but was required as: github.com/smartystreets/assertions

I believe goa just needs to update it’s go.mod indirect imports to resolve this. The upstream (convey) changed their dependencies.

raphael commented 1 year ago

I just released Goa v3.12.1 with updated dependencies.

dnapier commented 1 year ago

The issue persists. I think this is a trickle down dependency issue..

Unless I'm misreading it, goregen needs to either update their go.mod or your expr module needs to use convey directly rather than indirectly through goregen.

Smarty Assertions Issue 52

go: finding module for package github.com/smartystreets/assertions
go: finding module for package github.com/jtolds/gls
go: found github.com/jtolds/gls in github.com/jtolds/gls v4.20.0+incompatible
go: found github.com/smartystreets/assertions in github.com/smartystreets/assertions v1.15.0
go: [redacted] imports
        goa.design/goa/v3/dsl imports
        goa.design/goa/v3/expr imports
        github.com/zach-klippenstein/goregen tested by
        github.com/zach-klippenstein/goregen.test imports
        github.com/smartystreets/goconvey/convey imports
        github.com/smartystreets/assertions: github.com/smartystreets/assertions@v1.15.0: parsing go.mod:
        module declares its path as: github.com/smarty/assertions
                but was required as: github.com/smartystreets/assertions
dnapier commented 1 year ago

Seems that package is only used in one place:

expr example

maxmcd commented 1 year ago

Adding:

replace github.com/smartystreets/assertions v1.15.0 => github.com/smartystreets/assertions v1.13.0

To my go.mod fixes this for now.

raphael commented 1 year ago

Could you post repro steps for this issue? I can't seem to reproduce with a simple example, the following compiles and runs fine for me:

package main

import (
        "fmt"

        "goa.design/goa/v3/dsl"
)

func main() {
        it := dsl.Type("Person", func() {
                dsl.Attribute("name", dsl.String)
        })
        fmt.Println(it)
}

Given the following go.mod:

module example

go 1.20

require goa.design/goa/v3 v3.12.1

require (
    github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect
    github.com/google/uuid v1.3.0 // indirect
    github.com/gopherjs/gopherjs v1.17.2 // indirect
    github.com/jtolds/gls v4.20.0+incompatible // indirect
    github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect
    github.com/sergi/go-diff v1.3.1 // indirect
    github.com/smartystreets/assertions v1.13.1 // indirect
    github.com/stretchr/testify v1.8.3 // indirect
    github.com/zach-klippenstein/goregen v0.0.0-20160303162051-795b5e3961ea // indirect
    golang.org/x/mod v0.12.0 // indirect
    golang.org/x/sys v0.10.0 // indirect
    golang.org/x/text v0.11.0 // indirect
    golang.org/x/tools v0.11.0 // indirect
    gopkg.in/yaml.v3 v3.0.1 // indirect
)
dnapier commented 1 year ago

Tried it again and got the same error as before. Deleted smartystreets from go.mod and deleted go.sum, re-ran build commands and it worked. I think the difference was that assertions was being required as v1.15.0, but is now required as v1.13.1.