Closed Park-Jongseok closed 2 weeks ago
제보 감사합니다. 수정했습니다.
-----Original Message----- From: @.> To: @.>; Cc: @.***>; Sent: 2024-09-09 (월) 16:48:44 (GMT+09:00) Subject: [tuckersGo/mustHaveGo2] 모듈 경로 불일치에 의한 다운로드 불가능 문제 (Issue #1)
안녕하세요. Tucker의 Go 언어 프로그래밍 잘 보고 있습니다. 책을 읽던 중 (전자책 기준) p287 To Do Go 모듈을 만들고 외부 패키지 활용하기에서 잘 진행이 되지않아 Issue를 남깁니다. 문제 6번에서 아래의 명령어를 입력하면 에러가 발생합니다. ❯ go mod tidy go: finding module for package github.com/tuckersGo/musthaveGo2/ch14/expkg go: finding module for package github.com/guptarohit/asciigraph go: downloading github.com/tuckersGo/musthaveGo2/ch14/expkg v0.0.0-20240826025849-d355ccf77f31 go: downloading github.com/guptarohit/asciigraph v0.7.2 go: found github.com/guptarohit/asciigraph in github.com/guptarohit/asciigraph v0.7.2 go: found github.com/tuckersGo/musthaveGo2/ch14/expkg in github.com/tuckersGo/musthaveGo2/ch14/expkg v0.0.0-20240826025849-d355ccf77f31 go: go-project/usepkg imports github.com/tuckersGo/musthaveGo2/ch14/expkg: @.: parsing go.mod: module declares its path as: github.com/tuckersGo/musthaveGo/ch16/expkg but was required as: github.com/tuckersGo/musthaveGo2/ch14/expkg 아마도 ch14/expkg/go.mod에 선언된 경로와 실제 모듈이 요구하는 경로가 불일치하기 때문에 발생하는 것으로 보입니다. go.mod 파일에서 module github.com/tuckersGo/musthaveGo/ch16/expkg로 경로가 선언되어 있지만, 실제로는 ch14에 위치하고 있기 때문에 경로 불일치로 인해 Go 모듈 시스템에서 에러가 발생한 것 같습니다. 일시적인 해결 방법 go.mod에 다음 구문을 추가하여 해결했습니다. replace github.com/tuckersGo/musthaveGo2/ch14/expkg => github.com/tuckersGo/musthaveGo/ch16/expkg v0.0.0-20240731025516-da2218d06516 위의 버전은 Go Package 매니저에서 확인한 버전입니다. 이 replace 구문을 통해 go.mod에서 경로가 맞지 않는 모듈을 올바른 경로로 강제 매핑해주는것 같습니다. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.>
답변과 빠른 대응 감사합니다. 아래의 명령어를 실행한 결과 문제 없어보이기 때문에 이 이슈를 닫겠습니다.
❯ go mod tidy
go: finding module for package github.com/tuckersGo/musthaveGo2/ch14/expkg
go: finding module for package github.com/guptarohit/asciigraph
go: downloading github.com/tuckersGo/musthaveGo2/ch14/expkg v0.0.0-20240909140639-7b5a3ed5c934
go: found github.com/guptarohit/asciigraph in github.com/guptarohit/asciigraph v0.7.2
go: found github.com/tuckersGo/musthaveGo2/ch14/expkg in github.com/tuckersGo/musthaveGo2/ch14/expkg v0.0.0-20240909140639-7b5a3ed5c934
안녕하세요. Tucker의 Go 언어 프로그래밍 잘 보고 있습니다.
책을 읽던 중 (전자책 기준) p287 To Do Go 모듈을 만들고 외부 패키지 활용하기에서 잘 진행이 되지않아
Issue
를 남깁니다.문제
6번에서 아래의 명령어를 입력하면 에러가 발생합니다.
아마도 ch14/expkg/go.mod에 선언된 경로와 실제 모듈이 요구하는 경로가 불일치하기 때문에 발생하는 것으로 보입니다.
go.mod
파일에서module github.com/tuckersGo/musthaveGo/ch16/expkg
로 경로가 선언되어 있지만, 실제로는ch14
에 위치하고 있기 때문에 경로 불일치로 인해 Go 모듈 시스템에서 에러가 발생한 것 같습니다.일시적인 해결 방법
go.mod
에 다음 구문을 추가하여 해결했습니다.위의 버전은 Go Package 매니저에서 확인한 버전입니다. 이
replace
구문을 통해go.mod
에서 경로가 맞지 않는 모듈을 올바른 경로로 강제 매핑해주는것 같습니다.