Divide and Conquer

[에러해결] wc.go:5:2: package mapreduce is not in GOROOT (/usr/lib/go-1.18/src/mapreduce) 본문

성장캐/분산컴퓨팅

[에러해결] wc.go:5:2: package mapreduce is not in GOROOT (/usr/lib/go-1.18/src/mapreduce)

10살 2024. 5. 28. 19:25
728x90

s23710660@swye:~/sequential_mapreduce/src$ cd ~/sequential_mapreduce/src/main
go run wc.go master sequential ../pg-*.txt
$GOPATH/go.mod exists but should not
s23710660@swye:~/sequential_mapreduce/src/main$

Part 2에서 계속 위와 같은 문제가 발생
$GOPATH/go.mod exists but should not 오류는 Go 모듈 모드에서 $GOPATH 디렉토리에 go.mod 파일이 있을 때 발생
→GOPATH 환경 변수를 사용하지 않고, 모듈 모드에서 제대로 작동하도록 설정

# GOPATH를 확인 
echo $GOPATH
cd /home/s23710660/sequential_mapreduce
export GOPATH="$PWD"
echo $GOPATH
cd src

cd mapreduce 
go mod init mapreduce
go mod tidy

cd ..
export GO111MODULE=off
cd "$GOPATH/src/main"
go run wc.go master sequential pg-*.txt

잘 돌아감

 

 

 

 

반응형
Comments