go-gin 常见问题解决

安装过程中遇到的问题

  • cannot find package “github.com/go-playground/validator/v10”

    发现github上确实没有该代码

    • 解决方法:
    1
    2
    3
    4
    5
    # cd $GOPATH
    # go get "gopkg.in/go-playground/validator.v10"
    # cp -rf $GOPATH/src/gopkg.in/go-playground/validator.v10/* $GOPATH/src/vendor/github.com/go-playground/validator/v10/
    # govendor add +external
    复制代码
  • cannot find package “golang.org/x/sys/unix”

    • 解决方法:
    1
    2
    3
    4
    # mkdir -p $GOPATH/src/golang.org/x
    # cd $GOPATH/src/golang.org/x
    # git clone https://github.com/golang/sys.git
    # govendor add +external