Go:必要なモジュールはパッケージを提供しません...それを追加するには:...

Go:パッケージを提供する必要なモジュールはありません…それを追加するには:…


Go コンパイル エラーを記録する

プロジェクトアドレス:

https://github.com/apache/servicecomb-service-center

ソースコードの変更:

プロジェクトのルート ディレクトリのフロントエンドの名前をfrontend-sr​​cに変更します。

ここに画像の説明を挿入します

コンパイルエラー:

$ go build -o frontend
server.go:25:2: no required module provides package github.com/apache/servicecomb-service-center/frontend/schema; to add it:
        go get github.com/apache/servicecomb-service-center/frontend/schema

ここに画像の説明を挿入します

エラー メッセージに従って問題の解決を試みてください。

EB@DESKTOP-K45IA6V MINGW64 /d/workspace/sme/trunk/servicecomb/servicecomb-service-center-1.3.0/frontend-src
$ go get github.com/apache/servicecomb-service-center/frontend/schema
go get: module github.com/apache/servicecomb-service-center/frontend/schema: reading https://goproxy.io/github.com/apache/servicecomb-service-ce
nter/frontend/schema/@v/list: 404 Not Found
        server response: not found: github.com/apache/servicecomb-service-center/frontend/schema@latest: no matching versions for query "latest"

ここに画像の説明を挿入します

まだエラーが発生します。(実際にはそのようなモジュールがないため)

解決:

突然、frontend の名前をfrontend-sr​​c に変更したが、ソース コードのインポート パスを変更していなかったことを思い出しました。

ここに画像の説明を挿入します

プロジェクトの内部ディレクトリを変更する場合 (パッケージ名と場所の変更)、プロジェクト内のこのパッケージに依存するファイル内のこのパッケージのインポート パスも変更する必要があります。

名前を変更する

「github.com/apache/servicecomb-service-center/frontend/schema」をインポートします

「github.com/apache/servicecomb-service-center/frontend-sr​​c/schema」をインポートします

ここに画像の説明を挿入します

おすすめ

転載: blog.csdn.net/test1280/article/details/119735741