LoginSignup
1
0

Ebitengineの環境構築にちょっと苦労した話

Last updated at Posted at 2023-08-20

目次

  1. 概要
  2. 課題
  3. やったこと
  4. 結論

概要

Ebitengineの環境構築の確認(https://ebitengine.org/en/documents/install.html)
をやろうとしたらエラーが出た

課題

go run github.com/hajimehoshi/ebiten/v2/examples/rotate@latest

で確認する。
エラーがでた

package github.com/hajimehoshi/ebiten/v2/examples/rotate@latest: can only use path@version syntax with 'go get' and 'go install' in module-aware mode

やったこと

エラーは参照の方法をGOPATHからモジュールにしろっていうことっぽい
modファイル作ってmain()で動かしてみる。

powershell
go mod init TestEbiten
go get github.com/hajimehoshi/ebiten/v2/examples/rotate@latest

Goのソースコード

main.go
package main

import (
    "github.com/hajimehoshi/ebiten/v2/examples/rotate"
)

func main() {
    rotate.Run()
}

これもエラーがでた

..\..\go\pkg\mod\github.com\hajimehoshi\ebiten\v2@v2.5.6\examples\2048\main.go:20:2: //go:build comment without // +build comment
..\..\go\pkg\mod\github.com\hajimehoshi\ebiten\v2@v2.5.6\internal\restorable\images.go:20:2: //go:build comment without // +build comment
…

パッと見リポジトリの問題っぽいが、特に問題は報告されていないようなので+build commentで検索してみる。
どうやら、1.16で発生する問題らしい

結論

Goのバージョンの問題(1.16で発生するみたい)
https://go.dev/doc/install に従ってGoをアップデートしておく

参考:https://qiita.com/infinity0206/items/2c6a6cbdb906d5fc9f08

1
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
1
0