Spooky: go build ignores dependent library name change

Hi there!

This is really odd that I rename a dependent library in cgo import, and rebuild it with go build the fact is that the packaged still imports the old library (with the old name) .
Here is part of the code on importing C libraries:

/*
#cgo CFLAGS: -I.
#cgo LDFLAGS: -L . -lmarket65 -lthostmduserapi_se
#include "dll.h"
*/
import "C"

the lmarket65 used to have the name lmarket_n, I have copied libmarket_n.so in default shared library directory /usr/lib/ to libmarket65.so .

Then I used command:

go clean -cache
go build

And come up with the new TestMarket executable by go.
Then just probe what libraries it calles:

~/src/TestMarket$ ldd TestMarket
	linux-vdso.so.1 (0x00007fff924e2000)
	libmarket_n.so => /usr/lib/libmarket_n.so (0x00007ffb92a1e000)
	libthostmduserapi_se.so => /usr/lib/libthostmduserapi_se.so (0x00007ffb9210f000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ffb920ec000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffb91efa000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ffb91d19000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ffb91cfe000)
	/lib64/ld-linux-x86-64.so.2 (0x00007ffb92af1000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ffb91cf1000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffb91ceb000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ffb91b9c000)

See, it does not depend on the new library libmarket65.so but on the old libmarket_n.so where the nowhere in go files referenced!

Does this maybe have something to do with go modules caching build directories? I don’t know anything about modules, but do you need to do something to refresh the go.mod (or is it the go.sum) file(s)?

Thanks a lot! But there was no such mod file in the directory, which is the older version without such directory management.