mirror of
https://github.com/foomo/gocontemplate.git
synced 2025-10-16 12:35:36 +00:00
feat: bump go 1.22.3
This commit is contained in:
parent
a91a8189cb
commit
9a4219198a
12
go.mod
12
go.mod
@ -1,23 +1,17 @@
|
||||
module github.com/foomo/gocontemplate
|
||||
|
||||
go 1.22.2
|
||||
|
||||
toolchain go1.22.3
|
||||
go 1.22.3
|
||||
|
||||
require (
|
||||
github.com/foomo/sesamy-go v0.1.34-0.20240520134733-71fc83a0eb94
|
||||
github.com/stretchr/testify v1.9.0
|
||||
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842
|
||||
golang.org/x/tools v0.21.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/foomo/gostandards v0.1.0 // indirect
|
||||
github.com/kr/pretty v0.1.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/sync v0.7.0 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
20
go.sum
20
go.sum
@ -1,16 +1,7 @@
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/foomo/gostandards v0.1.0 h1:dN6Yoj5un74W8hooC+boYcdbkTzF9jqU39q5kQCkzn4=
|
||||
github.com/foomo/gostandards v0.1.0/go.mod h1:eyoFzndWb1kuDfupR/qf567mHeHZRi5//m64khreVac=
|
||||
github.com/foomo/sesamy-go v0.1.34-0.20240520134733-71fc83a0eb94 h1:HuLhNAVAB7WNiKDemeDzHvj3+WvYJVa4V8e9LiPsACM=
|
||||
github.com/foomo/sesamy-go v0.1.34-0.20240520134733-71fc83a0eb94/go.mod h1:zeYfOTHDzH9cQF8UjWmOUrMoPUM6LlvmY7IrliA9roQ=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM=
|
||||
@ -21,8 +12,7 @@ golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw=
|
||||
golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
@ -4,44 +4,42 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/foomo/gocontemplate/pkg/contemplate"
|
||||
_ "github.com/foomo/sesamy-go" // force inclusion
|
||||
_ "github.com/foomo/sesamy-go/event/params" // force inclusion
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestNewLoader(t *testing.T) {
|
||||
t.Parallel()
|
||||
goctpl, err := contemplate.Load(&contemplate.Config{
|
||||
ctpl, err := contemplate.Load(&contemplate.Config{
|
||||
Packages: []*contemplate.PackageConfig{
|
||||
{
|
||||
Path: "github.com/foomo/sesamy-go/event",
|
||||
Path: "github.com/foomo/gocontemplate/test/event",
|
||||
Types: []string{"PageView"},
|
||||
},
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Len(t, goctpl.Packages, 4)
|
||||
assert.Len(t, ctpl.Packages, 3)
|
||||
}
|
||||
|
||||
func TestLoader_LookupTypesByType(t *testing.T) {
|
||||
t.Parallel()
|
||||
goctpl, err := contemplate.Load(&contemplate.Config{
|
||||
ctpl, err := contemplate.Load(&contemplate.Config{
|
||||
Packages: []*contemplate.PackageConfig{
|
||||
{
|
||||
Path: "github.com/foomo/sesamy-go/event",
|
||||
Path: "github.com/foomo/gocontemplate/test/event",
|
||||
Types: []string{"PageView"},
|
||||
},
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
pkg := goctpl.Package("github.com/foomo/sesamy-go")
|
||||
pkg := ctpl.Package("github.com/foomo/gocontemplate/test")
|
||||
require.NotNil(t, pkg)
|
||||
pkgType := pkg.LookupType("Event")
|
||||
require.NotNil(t, pkgType)
|
||||
|
||||
pkgTypes := goctpl.LookupTypesByType(pkgType)
|
||||
pkgTypes := ctpl.LookupTypesByType(pkgType)
|
||||
assert.NotEmpty(t, pkgTypes)
|
||||
}
|
||||
|
||||
8
test/currency.go
Normal file
8
test/currency.go
Normal file
@ -0,0 +1,8 @@
|
||||
package test
|
||||
|
||||
type Currency string
|
||||
|
||||
const (
|
||||
CurrencyEUR Currency = "EUR"
|
||||
CurrencyUSD Currency = "USD"
|
||||
)
|
||||
6
test/event.go
Normal file
6
test/event.go
Normal file
@ -0,0 +1,6 @@
|
||||
package test
|
||||
|
||||
type Event[T any] struct {
|
||||
Name string `json:"name"`
|
||||
Params T `json:"params,omitempty"`
|
||||
}
|
||||
8
test/event/pageview.go
Normal file
8
test/event/pageview.go
Normal file
@ -0,0 +1,8 @@
|
||||
package event
|
||||
|
||||
import (
|
||||
"github.com/foomo/gocontemplate/test"
|
||||
"github.com/foomo/gocontemplate/test/params"
|
||||
)
|
||||
|
||||
type PageView test.Event[params.PageView]
|
||||
9
test/params/pageview.go
Normal file
9
test/params/pageview.go
Normal file
@ -0,0 +1,9 @@
|
||||
package params
|
||||
|
||||
import (
|
||||
"github.com/foomo/gocontemplate/test"
|
||||
)
|
||||
|
||||
type PageView struct {
|
||||
Currency test.Currency `json:"currency,omitempty"`
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user