shenkonghui / issue

问题记录
0 stars 0 forks source link

failed to initialize project: unable to inject the configuration to "go.kubebuilder.io/v2" #163

Closed shenkonghui closed 2 years ago

shenkonghui commented 2 years ago

operator-sdk初始化失败

operator-sdk init  --domain  --repo xxx --project-version 2
Error: failed to initialize project: unable to inject the configuration to "go.kubebuilder.io/v2": error finding current repository: could not determine repository path from module data, package data, or by initializing a module: go: cannot determine module path for source directory /Users/shenkonghui/src/work/mysql-operator (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.

Usage:
  operator-sdk init [flags]

Examples:
  # Initialize a new project with your domain and name in copyright
  operator-sdk init --plugins go/v2 --domain example.org --owner "Your name"

  # Initialize a new project defining a specific project version
  operator-sdk init --plugins go/v2 --project-version 2

Flags:
      --domain string            domain for groups (default "my.domain")
      --fetch-deps               ensure dependencies are downloaded (default true)
  -h, --help                     help for init
      --license string           license to use to boilerplate, may be one of 'apache2', 'none' (default "apache2")
      --owner string             owner to add to the copyright
      --project-name string      name of this project
      --project-version string   project version (default "3")
      --repo string              name to use for go module (e.g., github.com/user/repo), defaults to the go package of the current working directory.
      --skip-go-version-check    if specified, skip checking the Go version

Global Flags:
      --plugins strings   plugin keys to be used for this subcommand execution
      --verbose           Enable verbose logging

FATA[0000] failed to initialize project: unable to inject the configuration to "go.kubebuilder.io/v2": error finding current repository: could not determine repository path from module data, package data, or by initializing a module: go: cannot determine module path for source directory /Users/shenkonghui/src/work/mysql-operator (outside GOPATH, module path must be specified)
shenkonghui commented 2 years ago

operator-sdk版本与golang版本不兼容。 更新golang最新版本,或者增加参数--project-version 2 ,以旧版本安装