Trying to follow the installation guide here and most of the process is working. I'm having an issue with building it however.
When trying to build I'm getting this message:
C:...\gameboy.live>go build -o gbdotlive main.go
......\go\pkg\mod\fyne.io\fyne#v1.0.1\driver\gl\gl.go:20:2: missing go.sum entry for module providing package github.com/goki/freetype (imported by fyne.io/fyne/driver/gl); to add:
go get fyne.io/fyne/driver/gl#v1.0.1
Running the suggested command however raises another prompt:
C:...\gameboy.live>go get fyne.io/driver/gl#v1.0.1
go get fyne.io/driver/gl#v1.0.1: unrecognized import path "fyne.io/driver/gl": reading https://fyne.io/driver/gl?go-get=1: 404 Not Found
I've tried going for the version 1.4.3 driver too which raises a different error:
C:...\gameboy.live>go get fyne.io/fyne/gl#v1.4.3
go get: module fyne.io/fyne#v1.4.3 found, but does not contain package fyne.io/fyne/gl
Anybody familiar with this issue? FYI I'm on Windows and have MinGw installed already.
Just run go mod tidy before exec go build -o gbdotlive main.go.Have a try.
A Go language tutorial uses the "quote" package to get familiar quotes. When I give the command "go get -v rsc.io/quote", I get the message
code in directory.../github/hello/src/rsc.io/quote/v3 expects import "rsc.io/quote"
So I went there and looked at the code. It has an import statement:
import "rsc.io/quote/v3"
So I thought maybe I had the wrong version of quote. Accordingly, I tried "go get -v rsc.io/quite/v3" THis produces the message:
code in directory .../rsc.io/quote/v3 expects import "rsc.io/quote."
This seems circular: asking without a version number produces a requirement for a versioned package, but trying to get a versioned package produces a requirement without a version number.
If you continue the tutorial to the end you will see that the addition of a go module, and the subsequent initialisation, will resolve your issue. The .mod file will pull in the required dependencies.
Can you try
go get -v rsc.io/quote
get "rsc.io/quote": found meta tag get.metaImport{Prefix:"rsc.io/quote", VCS:"git", RepoRoot:"https://github.com/rsc/quote"} at //rsc.io/quote?go-get=1
rsc.io/quote (download)
get "rsc.io/sampler": found meta tag get.metaImport{Prefix:"rsc.io/sampler", VCS:"git", RepoRoot:"https://github.com/rsc/sampler"} at //rsc.io/sampler?go-get=1
rsc.io/sampler (download)
github/gospace/src/rsc.io/quote/quote.go:8:8: code in directory /Users/james/github/gospace/src/rsc.io/quote/v3 expects import "rsc.io/quote"
cat $GOPATH/src/rsc.io/quote/v3/go.mod
module rsc.io/quote/v3
require rsc.io/sampler v1.3.0
~> cat $GOPATH/src/rsc.io/quote/v3/go.sum
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c h1:qgOY6WgZOaTkIIMiVjBQcw93ERBE4m30iBm00nkL0i8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
rsc.io/sampler v1.99.99 h1:7i08f/p5TBU5joCPW3GjWG1ZFCmr28ybGqlXtelhEK8=
rsc.io/sampler v1.99.99/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
More about go get vs go install. What is the difference between go get and go install?
Can you please check your GO env path settings:
export GOPATH=$HOME/github/<your_workspace_name>
export GOBIN=$GOPATH/bin
export GOROOT=/usr/local/go
export PATH=$PATH:/usr/local/bin:/usr/local/go/bin:$GOPATH/bin
Here is a good source for setting up workspace:
https://golang.org/doc/gopath_code.html
As #MartinBennett mentioned, it's already mentioned in the tutorial but may be not so clear.
Once you add import "rsc.io/quote" in your hello.go file, you will need to run these commands in your terminal:
1-
go mod init hello
2-
go run hello.go
Relatively new to GRPC and getting an error in my proto file that I cannot seem to make sense of. I would like to send a time in a message using the "google.protobuf.Timestamp". I cannot seem to import it. What am I doing wrong?
syntax = "proto3";
import "google/protobuf/timestamp.proto";
service ProfileService {
rpc ConstructProfileStructFromUser (ConstructProfileStructFromUserRequest) returns (ConstructProfileStructFromUserResponse);
}
message ConstructProfileStructFromUserRequest {
string transactionID = 1;
string User = 2;
}
message ConstructProfileStructFromUserResponse {
string UID = 1;
string ContactEmail = 2;
google.protobuf.Timestamp DateOfBirth = 3;
}
Both in my IDE and my compiler (using the below command) then I get the error
google/protobuf/timestamp.proto: File not found.
profile.proto: Import "google/protobuf/timestamp.proto" was not found or had errors.
profile.proto:21:5: "google.protobuf.Timestamp" is not defined.
Command to run:
protoc -I profile/ profile/profile.proto --go_out=plugins=grpc:profile
Protoc --version
libprotoc 3.0.0
I had this issue after installing the protoc compiler using the apt package manager (Ubuntu) and it put the protoc compiler somewhere like /usr/local/bin.
It seems by default protoc expects imports to be present in an include path relative to the protoc installation directory. For example:
protoc location: /usr/local/bin/protoc
include location: /usr/local/bin/include/*
Install pre-compiled binaries (any OS)
Downloading a pre-compiled binary as indicated below will have the needed include directory.
Instructions from grpc.io/docs/protoc-installation
Manually download from github.com/google/protobuf/releases the zip file corresponding to your operating system and computer architecture (protoc--.zip), or fetch the file using commands such as the following:
PB_REL="https://github.com/protocolbuffers/protobuf/releases"
curl -LO $PB_REL/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip
Unzip the file under $HOME/.local or a directory of your choice. For example:
unzip protoc-3.15.8-linux-x86_64.zip -d $HOME/.local
Update your environment’s path variable to include the path to the protoc executable. For example:
export PATH="$PATH:$HOME/.local/bin"
If you installed protoc with your package manager, you only have to install the libprotobuf-dev (Ubuntu) or protobuf-devel (Fedora) package.
In general, you can find the containing package of a file on Ubuntu with
apt-file find google/protobuf/timestamp.proto
or on Fedora
dnf repoquery --file "**/google/protobuf/timestamp.proto" (this is how I found the package I needed). Other package managers probably have similar commands.
My problem was quite simple...
I didn't have the timestamp.proto downloaded locally and as a result it couldn't find it.
I cloned:
https://github.com/protocolbuffers/protobuf/tree/master/src/google/protobuf
And then when I run my compiler I have to give it the location to locate the timestamp.proto files.
For me it was...
protoc -I profile/ -I MY_CLONED_REPO_LOCATION/protobuf/src profile/profile.proto --go_out=plugins=grpc:profile
Once it knew where it had the path to the source then it could find it with no issues.
I had same problem with protoc 3.0.0 installed from ubuntu repo. I have found another solution, without reinstalling protobuf as #SwiftD suggested, using --proto_path protoc option.
In your .proto import should look like (i.e. without path):
syntax = "proto3";
import "timestamp.proto"
Then in the protoc invocation you pass absolute path to your package directory containing timestamp.proto (I use github.com/golang/protobuf/ptypes/timestamp) using --proto_path option.
protoc kcproto.proto --go_out=./ --proto_path=/home/my_home_dir_name/go/src/github.com/golang/protobuf/ptypes/timestamp --proto_path=./
replace /home/my_home_dir_name/ with your go package directory
For mac, I run this in the terminal
PROTOC_ZIP=protoc-3.14.0-osx-x86_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
Note that you can change the version protoc-3.14.0 to whatever your need, for example protoc-3.x.x
Docs: http://google.github.io/proto-lens/installing-protoc.html
If you download from https://github.com/protocolbuffers/protobuf/releases, in the download directory there is an include directory, where all the google defined types (such as google/protobuf/timestamp.proto) live.
You can pass in an extra parameter --proto_path=/path/to/include to your protoc command, and it should work.
Go to the VSCode proto 3 extension settings and paste "protocol" at the end of the file:
"protoc": {
"options": [
"--proto_path=proto",
]
}
}
I had the same problem with
import "google/protobuf/timestamp.proto";
I'm on a fedora and installed protocol buffer compiler using the package manager dnf .
solution : delete your current protoc using then package manger .
on fedora:
sudo dnf remove protobuf-compiler
then follow the instruction to Install pre-compiled binaries (any OS) :
find the appropriate version of compiler herer https://github.com/protocolbuffers/protobuf/releases
unzip it in somewhere in your PATH . for example you can do something like this : $ unzip protoc-3.15.8-linux-x86_64.zip -d $HOME/.local
DONE !
What I ended up doing in same situation was to include
message google {
message protobuf {
message Timestamp {
int64 seconds = 1;
int32 nanos = 2;
}
}
}
In my proto-file. That was enough for it to be recognized as well known type, so in python I get the addition API described at https://developers.google.com/protocol-buffers/docs/reference/python-generated#timestamp.
The main advantage is that we all can keep using the system install of protoc and don't have to install from source.
I am trying to run golang application which use goracle library with such Dockerfile:
FROM golang:1.12
RUN go get github.com/gorilla/mux && \
go get github.com/gorilla/handlers && \
go get github.com/lib/pq && \
go get github.com/joho/godotenv && \
go get github.com/jinzhu/gorm && \
go get gopkg.in/goracle.v2
ADD ./ /go/src/application
WORKDIR /go/src/application
RUN go build -o /bin application
ENV PORT=8000
CMD ["/bin"]
Unfortunatly it raise error when I try to create image:
package gopkg.in/goracle.v2: unrecognized import path "gopkg.in/goracle.v2" (https fetch: Get https://gopkg.in/goracle.v2?go-get=1: proxyconnect tcp: tls: first record does not look like a TLS handshake)
The command '/bin/sh -c go get github.com/gorilla/mux && go get github.com/gorilla/handlers && go get github.com/lib/pq && go get github.com/joho/godotenv && go get github.com/jinzhu/gorm && go get gopkg.in/goracle.v2' returned a non-zero code: 1
Why I can't install goracle library in Docker? How to fix this problem?
In my case the CentOS server where was located Docker has proxy. For thats why I couldn't download the gopkg.in/goracle.v2 package.
SOLUTION:
1) Create vender folder inside your project.
2) Remove source code of gopkg.in/goracle.v2 package which you has in go/src folder to vender folder.
3) Run you Dockerfile.
In my case this instruction removed problem with importing of gopkg.in/goracle.v2
package.
I hope this post will helpful for somebody!
I have tried to install influx db on windows 10 using following steps from a blog.
However after "go get -u -f ./..." command I get following error message.
C:\>cd Go
C:\Go>mkdir projects
C:\Go>set "GOPATH=C:\Go\projects"
C:\Go>cd %gopath%
C:\Go\projects>go get github.com/influxdata/influxdb
C:\Go\projects>cd src\github.com\influxdata\influxdb
C:\Go\projects\src\github.com\influxdata\influxdb>go get -u -f ./...
package github.com/uber-go/zap: code in directory C:\Go\projects\src\github.com\uber-go\zap expects import "go.uber.org/zap"
Looks like there is a current issue with the Zap library:
https://github.com/influxdata/influxdb/pull/8029#issuecomment-281432839
You can download a pre-compiled Windows binary from the Influxdata website:
https://portal.influxdata.com/downloads