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

Add ResolveTCPAddr ResolveUnixAddr #5

Open
hmmftg opened this issue Nov 16, 2023 · 3 comments
Open

Add ResolveTCPAddr ResolveUnixAddr #5

hmmftg opened this issue Nov 16, 2023 · 3 comments

Comments

@hmmftg
Copy link

hmmftg commented Nov 16, 2023

Hi, I newly started using tiny go, when I tried build my gin project I got these errors:

tinygo build -o a.out main
# github.com/go-playground/validator/v10
vendor/github.com/go-playground/validator/v10/baked_in.go:2350:16: undefined: net.ResolveTCPAddr
vendor/github.com/go-playground/validator/v10/baked_in.go:2360:16: undefined: net.ResolveTCPAddr
vendor/github.com/go-playground/validator/v10/baked_in.go:2371:16: undefined: net.ResolveTCPAddr
vendor/github.com/go-playground/validator/v10/baked_in.go:2382:16: undefined: net.ResolveUDPAddr
vendor/github.com/go-playground/validator/v10/baked_in.go:2393:16: undefined: net.ResolveUDPAddr
vendor/github.com/go-playground/validator/v10/baked_in.go:2404:16: undefined: net.ResolveUDPAddr
vendor/github.com/go-playground/validator/v10/baked_in.go:2415:16: undefined: net.ResolveIPAddr
vendor/github.com/go-playground/validator/v10/baked_in.go:2426:16: undefined: net.ResolveIPAddr
vendor/github.com/go-playground/validator/v10/baked_in.go:2437:16: undefined: net.ResolveIPAddr
vendor/github.com/go-playground/validator/v10/baked_in.go:2444:16: undefined: net.ResolveUnixAddr

I don't really need ResolveTCPAddr but if you please add this method to library, I can start using tinygo.

@scottfeldman
Copy link
Contributor

Hello @hmmftg,

I believe based on your err listing that you're using standard TinyGo compiler, which doesn't have support for net.ResolveXXXAddr. This github project (tinygo-org/net) is an effort to update TinyGo's net package support, but it is not included in standard TinyGo. It will be in the future and it will include support for net.ResolveXXXAddr.

A work-around for you would be to add stubbed out versions of net.ResolveTCPAddr to the tinygo project (tinygo-org/tinygo/src/net). Just to make the compiler happy so you can continue.

An alternate work-around is to try with the development version of TinyGo that includes this github project. I can give you tips on building a custom tinygo if you want to go this route.

@scottfeldman
Copy link
Contributor

@hmmftg, if you don't want to wait for the next release, please try the dev version of TinyGo. It should have support:

sfeldma@nuc:~/work/tinygo/src/net$ grep -r "func Resolve.*Addr" .
./udpsock.go:func ResolveUDPAddr(network, address string) (*UDPAddr, error) {
./tcpsock.go:func ResolveTCPAddr(network, address string) (*TCPAddr, error) {

@hmmftg
Copy link
Author

hmmftg commented Dec 18, 2023

actually I was thinking about migrating a big rest api written with gin to tiny go, it seems I'm going in wrong path. no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants