fix: use go:build tools instead of ignore so go mod tidy doesn't remove deps

This commit is contained in:
Laytan Laats 2023-03-26 01:33:03 +01:00
parent 25877adda4
commit 92019441d0
2 changed files with 3 additions and 14 deletions

View File

@ -1,5 +1,4 @@
//go:build ignore //go:build tools
// +build ignore
package main package main
@ -33,12 +32,7 @@ var fileTempl = template.Must(
package traverser package traverser
import ( import "github.com/VKCOM/php-parser/pkg/ast"
"github.com/VKCOM/php-parser/pkg/ast"
// Importing packages here, so that go mod tidy does not remove the dependency on it.
// It is used in traverser_gen.go but that is ignored with go mod tidy.
"golang.org/x/tools/go/packages"
)
{{range $typ := .Types}} {{range $typ := .Types}}
func (t *Traverser) {{$typ.FuncName}}(n *ast.{{$typ.Name}}) { func (t *Traverser) {{$typ.FuncName}}(n *ast.{{$typ.Name}}) {
if !t.checkEntrance(n) { if !t.checkEntrance(n) {

View File

@ -2,12 +2,7 @@
package traverser package traverser
import ( import "github.com/VKCOM/php-parser/pkg/ast"
"github.com/VKCOM/php-parser/pkg/ast"
// Importing packages here, so that go mod tidy does not remove the dependency on it.
// It is used in traverser_gen.go but that is ignored with go mod tidy.
"golang.org/x/tools/go/packages"
)
func (t *Traverser) Root(n *ast.Root) { func (t *Traverser) Root(n *ast.Root) {
if !t.checkEntrance(n) { if !t.checkEntrance(n) {