Skip to content

Commit

Permalink
Add pkgsite tool. (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrt authored Dec 17, 2024
1 parent fc9d1fe commit cca4e9b
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 36 deletions.
Binary file modified dbz/internal/assets/sqlc/plugin.wasm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/axw/gocov v1.2.1
github.com/compose-spec/compose-go v1.20.2
github.com/fatih/color v1.18.0
github.com/ibrt/golang-utils v0.11.0
github.com/ibrt/golang-utils v0.12.0
github.com/jackc/pgx/v5 v5.7.1
github.com/jackc/tern/v2 v2.3.0
github.com/onsi/gomega v1.36.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUq
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI=
github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/ibrt/golang-utils v0.11.0 h1:ZeYUvDZLDyIzfGdaXrtU4i3HholSyazEud6RUQSh83I=
github.com/ibrt/golang-utils v0.11.0/go.mod h1:KQF3oD7IWvTri0Plm/tAVwppoh16f4r8zGO+FCMzyiA=
github.com/ibrt/golang-utils v0.12.0 h1:vQ0YczIpT4RLQAQ5z+oz62J3tEajoniyCOjIJJvlJl4=
github.com/ibrt/golang-utils v0.12.0/go.mod h1:KQF3oD7IWvTri0Plm/tAVwppoh16f4r8zGO+FCMzyiA=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
Expand Down
23 changes: 1 addition & 22 deletions gtz/gtz.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,12 @@ var (
GoToolGoCovHTML = NewGoTool("github.com/matm/gocov-html", "cmd/gocov-html", "v1.4.0")
GoToolGolint = NewGoTool("golang.org/x/lint", "golint", "v0.0.0-20210508222113-6edffad5e616")
GoToolMockGen = NewGoTool("go.uber.org/mock", "/mockgen", "v0.5.0")
GoToolPkgsite = NewGoTool("golang.org/x/pkgsite", "cmd/pkgsite", "latest")
GoToolSQLC = NewGoTool("github.com/sqlc-dev/sqlc", "cmd/sqlc", "v1.27.0")
GoToolSQLCGenGo = NewGoTool("github.com/sqlc-dev/sqlc-gen-go", "", "v1.4.0")
GoToolStaticCheck = NewGoTool("honnef.co/go/tools", "cmd/staticcheck", "2024.1.1")
)

// MustLookupGoTool returns a [*GoTool]
func MustLookupGoTool(key string) *GoTool {
switch key {
case "go-cov":
return GoToolGoCov
case "go-cov-html":
return GoToolGoCovHTML
case "golint":
return GoToolGolint
case "mock-gen":
return GoToolMockGen
case "sqlc":
return GoToolSQLC
case "sqlc-gen-go":
return GoToolSQLCGenGo
case "static-check":
return GoToolStaticCheck
default:
panic(errorz.Errorf("unknown go tool: %v", key))
}
}

// GoTool describes a Go tool.
type GoTool struct {
m *sync.Mutex
Expand Down
11 changes: 0 additions & 11 deletions gtz/gtz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@ func TestSuite(t *testing.T) {
fixturez.RunSuite(t, &Suite{})
}

func (*Suite) TestMustLookupGoTool(g *WithT) {
g.Expect(gtz.MustLookupGoTool("go-cov")).To(Equal(gtz.GoToolGoCov))
g.Expect(gtz.MustLookupGoTool("go-cov-html")).To(Equal(gtz.GoToolGoCovHTML))
g.Expect(gtz.MustLookupGoTool("golint")).To(Equal(gtz.GoToolGolint))
g.Expect(gtz.MustLookupGoTool("mock-gen")).To(Equal(gtz.GoToolMockGen))
g.Expect(gtz.MustLookupGoTool("sqlc")).To(Equal(gtz.GoToolSQLC))
g.Expect(gtz.MustLookupGoTool("sqlc-gen-go")).To(Equal(gtz.GoToolSQLCGenGo))
g.Expect(gtz.MustLookupGoTool("static-check")).To(Equal(gtz.GoToolStaticCheck))
g.Expect(func() { gtz.MustLookupGoTool("unknown") }).To(PanicWith(MatchError("unknown go tool: unknown")))
}

func (*Suite) TestGoTool(g *WithT) {
gtz.GoToolGolint.MustRun(".")

Expand Down

0 comments on commit cca4e9b

Please sign in to comment.