0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Goの最初に行うinitでの初歩的なミス備忘録

Posted at

発現法

Goのプロジェクトを立ち上げて、main.goを作成します。package main を記述してgo mod initコマンドを打ち込んで初期化を行おうとしました。下記のエラー発現。

エラー内容

go: cannot determine module path for source directory /Users/hogehoge(outside GOPATH, module path must be specified)

Example usage:
        'go mod init example.com/m' to initialize a v0 or v1 module
        'go mod init example.com/m/v2' to initialize a v2 module

Run 'go help mod init' for more information.

解決策

go mod init あなたのプロジェクト名(モジュール名?) と最後にモジュール名を指定する必要がありました。例えば、あなたの作成したプロジェクト名がtestだとしたら、行う初期化コマンドはgo mod init testになります。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?