go build:cannot find package

1.作業
golangで作成したapplicationをCentOS 8 からCentOS stream 9 に移行する

2.環境

# go version
go version go1.17.5 linux/amd64

# uname -a
Linux localhost.localdomain 5.14.0-109.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jun 10 09:54:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

3.golang build 時のerror
cannot find package

4.GO111MODULE を off に変更
https://maelvls.dev/go111module-everywhere/
if you want to keep using the old GOPATH way, you will have to force Go not to use the Go Modules feature:
export GO111MODULE=off

# go env |grep GO111MODULE
GO111MODULE="auto"
# go env -w  GO111MODULE=off
# go env |grep GO111MODULE
GO111MODULE="off"

5.pakageのinstall
# go get …