#I am trying to use the validator module

1 messages · Page 1 of 1 (latest)

elder tartan
#

where is the validator module? Will try to repro

#

oh sorry... I just realized I think you meant "validator module" as in "validator go module" 🙂

#

I'll see what happens if I try to use that in my own module

#

So far I can't repro (using v0.9.1)

main.go:

package main

import (
    "context"
    "github.com/go-playground/validator/v10"
)

type Test struct{}

type FooStruct struct {
    Bar string
}

func (m *Test) Fn(ctx context.Context) error {
    validate := validator.New(validator.WithRequiredStructEnabled())
    return validate.Struct(FooStruct{})
}

I just ran go get github.com/go-playground/validator/v10 and after my go.mod looks like:

module test

go 1.21.2

require (
        github.com/99designs/gqlgen v0.17.31
        github.com/Khan/genqlient v0.6.0
        golang.org/x/exp v0.0.0-20231006140011-7918f672742d
        golang.org/x/sync v0.3.0
)

require (
        github.com/gabriel-vasile/mimetype v1.4.2 // indirect
        github.com/go-playground/locales v0.14.1 // indirect
        github.com/go-playground/universal-translator v0.18.1 // indirect
        github.com/go-playground/validator/v10 v10.15.5
        github.com/leodido/go-urn v1.2.4 // indirect
        github.com/stretchr/testify v1.8.3 // indirect
        github.com/vektah/gqlparser/v2 v2.5.6 // indirect
        golang.org/x/crypto v0.7.0 // indirect
        golang.org/x/net v0.8.0 // indirect
        golang.org/x/sys v0.13.0 // indirect
        golang.org/x/text v0.8.0 // indirect
)
hexed nova
#

That's strange.. I wonder if it's because i have the modules nested in a different way. Let me try some things

#

still not working for me. My go.mod is the same as yours

#

I tried deleting go.sum and re-creating it too

#

As this is the base module it's not nested so my dagger.json looks very simple too

{
  "name": "FmrDocker",
  "sdk": "go"
}
#

let me upgrade to 0.9.2 and try

#

oh shoot! ok updating to 0.9.2 revealed this. So, it's good we know the issue now but not so good that I'm now stuck on my local machine too without the ability to specify the certs.