go-callvis icon indicating copy to clipboard operation
go-callvis copied to clipboard

the parametes '-tags' not take effect

Open cgyFight opened this issue 4 years ago • 2 comments

~help wanted I make an examples, the project dir like this: . ├── dir1 │ ├── f1.go │ └── f1_nolic.go └── main.go

if i build with

go build

it will call the f1.go function TfuncA if i build with

go build -tags nolic

it will call the f2.go function TfuncA

but whether i use -tags with nolic in go-callvis, they both call f1.go function TfuncA :

go-callvis -tags nolic .
go-callvis .

Did I use it wrong?

main.go

package main

import (
	"cgy/test-calvis/dir1"
)

func main() {
	println("hello")
	dir1.TfuncA()
}

f1.go

//+build !nolic

package dir1

func TfuncB() {
	println("t func b")
}

func TfuncA() {
	println("t func a")
	TfuncB()
}

f1_nolic.go

//+build nolic

package dir1

func TfuncA() {
	println("t func a nolic")
}

cgyFight avatar Jan 11 '21 07:01 cgyFight

similar situation with you when I integrate with c++ librdkafka SDK , error as like below

go-callvis -tags=dynamic  ./src/cmd/app.go

image

system env:


mac m1   Monterey 12.0.1  

go 1.17.6

cgo related 

CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/dp/m7czp6r110x0rsskffnn0_t40000gn/T/go-build2512158920=/tmp/go-build -gno-record-gcc-switches -fno-common"

however I use

go build -tags dynamic ./src/cmd

is okay

yanjinbin avatar Jan 17 '22 16:01 yanjinbin

-Qunused-argume
  • [x] fix it replay myself , go-callvis use go build , so try go build [your main package directory not your main.go filename ]

yanjinbin avatar Jan 18 '22 02:01 yanjinbin