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
// +build ignore
//go:build tools
package main
@ -33,12 +32,7 @@ var fileTempl = template.Must(
package traverser
import (
"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"
)
import "github.com/VKCOM/php-parser/pkg/ast"
{{range $typ := .Types}}
func (t *Traverser) {{$typ.FuncName}}(n *ast.{{$typ.Name}}) {
if !t.checkEntrance(n) {

View File

@ -2,12 +2,7 @@
package traverser
import (
"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"
)
import "github.com/VKCOM/php-parser/pkg/ast"
func (t *Traverser) Root(n *ast.Root) {
if !t.checkEntrance(n) {