Skip to content

Commit

Permalink
feat: bump go 1.22.3
Browse files Browse the repository at this point in the history
  • Loading branch information
franklinkim committed May 21, 2024
1 parent a91a818 commit 9a42191
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 33 deletions.
12 changes: 3 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 15 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand All @@ -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=
16 changes: 7 additions & 9 deletions pkg/contemplate/contemplate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 8 additions & 0 deletions test/currency.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package test

type Currency string

const (
CurrencyEUR Currency = "EUR"
CurrencyUSD Currency = "USD"
)
6 changes: 6 additions & 0 deletions test/event.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package test

type Event[T any] struct {
Name string `json:"name"`
Params T `json:"params,omitempty"`
}
8 changes: 8 additions & 0 deletions test/event/pageview.go
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions test/params/pageview.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package params

import (
"github.com/foomo/gocontemplate/test"
)

type PageView struct {
Currency test.Currency `json:"currency,omitempty"`
}

0 comments on commit 9a42191

Please sign in to comment.