Limit fake line numbers

pull/110/head
pagran 5 years ago
parent cc17f48dff
commit cddfd69257

@ -3,7 +3,6 @@ package main
import (
"fmt"
"go/ast"
"go/token"
mathrand "math/rand"
"strings"
@ -80,12 +79,12 @@ func findBuildTags(commentGroups []*ast.CommentGroup) (buildTags []string) {
return buildTags
}
func transformLineInfo(file *ast.File, fset *token.FileSet) ([]string, *ast.File) {
func transformLineInfo(file *ast.File) ([]string, *ast.File) {
// Save build tags and add file name leak protection
extraComments := append(findBuildTags(file.Comments), "", "//line :1")
file.Comments = nil
newLines := mathrand.Perm(fset.File(file.Package).LineCount())
newLines := mathrand.Perm(len(file.Decls))
funcCounter := 0
pre := func(cursor *astutil.Cursor) bool {

@ -526,7 +526,7 @@ func transformCompile(args []string) ([]string, error) {
// messy.
name = "_cgo_" + name
default:
extraComments, file = transformLineInfo(file, fset)
extraComments, file = transformLineInfo(file)
file = transformGo(file, info, blacklist)
// Uncomment for some quick debugging. Do not delete.

Loading…
Cancel
Save