Simple question I am trying to import Java.io.* to use
BufferedInputStream
FileOutputStream
BufferOutputStream
However even when I import them I get the following error:
"The package “java.io.BufferOutputStream” does not exist. You might be missing a library."
What am I missing here?
Its cool guys it was a classic FAIL... java typo.
it should be:
import java.io.BufferedOutputStream
Related
I want to use timestamppb package in my protobufs because it helps to easily convert Timestamp to Go time. Time. However, I can't figure out how to import it into the .proto file. When I try I get the following error Import "google.golang.org/protobuf/types/known/timestamppb" was not found or had errors.
I looked at the documentation timestamppb docs for the timestamppb package but it seems there are no examples of how to use it in .proto files.
syntax = "proto3";
import "google.golang.org/protobuf/types/known/timestamppb";
// import "google.golang.org/protobuf/types/known/timestamppb.proto"; I tried this too but no luck
message Example {
timestamppb.Timestamp example_time = 1;
}
The import for .proto files is:
import "google/protobuf/timestamp.proto";
The one that you tried is the path that is needed in Go Code in combination with go get.
I'm getting this error on the airflow UI. the code line I've entered is:
from airflow.contrib.sensors.file_sensor import FileSensor
any ideas?
found nothing on google.
thanks
Are you using an Airflow version < 1.10, e.g. 1.9?
In that case, try the following:
from airflow.contrib.operators.fs_operator import FileSensor
I tried this in v1.10.9 and the following both work.
from airflow.contrib.sensors.file_sensor import FileSensor
from airflow.contrib.operators.fs_operator import FileSensor
See the following links for reference:
https://github.com/apache/airflow/blob/v1-9-stable/airflow/contrib/operators/fs_operator.py
https://github.com/apache/airflow/blob/v1-9-stable/airflow/contrib/operators/init.py
I installed the PhotoViewer as explained in: https://github.com/sarriaroman/photoviewer
When I add import like this the project:
import {PhotoViewer} from 'ionic-native';
it doesn't compile and it says that PhotoViewer is not part of 'ionic-native'
Anyone knows why?
import { PhotoViewer } from '#ionic-native/photo-viewer'
http://ionicframework.com/docs/native/photo-viewer/
Fix your import. Just 'ionic-native' won't work.
I'm stuck on running the BeeGO app using "bee run" it says
The thing is I've already have setup properly my GOPATH to D:/Web Dev/GO/BeeGO/test-project/
and also routers path does exist and I've tried to manual build the file but it doesn't generate an .exe file.
Anyone knows how to fix this?
I'm using Windows 8.1 Pro (64-bit)
Thanks
GO expects the directory structure under $GOPATH in following ways as described in code organization:
$GOPATH/src <--- where your source code goes
/pkg
/bin
Instead of placing your source files directly under $GOPATH (D:/Web Dev/GO/BeeGO/test-project/ for your case), you want to move your code under $GOPATH/src.
D:/Web Dev/GO/BeeGO/test-project/src/main.go
D:/Web Dev/GO/BeeGO/test-project/src/quickstart/routers/routers.go
D:/Web Dev/GO/BeeGO/test-project/src/quickstart/controllers/controllers.go
import path should be always starting from $GOPATH/src. routers.go can be always imported as import "quickstart/routers" and controllers.go can be imported as import "quickstart/controllers".
That's not how you import a package.
The import path is relative to $GOPATH/src. use:
import "quickstart/routers"
Finally fixed the bug from the framework,
What I did:
in main.go import from
"D:/Web Dev/GO/BeeGO/test-project/quickstart/routers"
I changed it to _"../quickstart/routers" make sure to include _ this means to import the library even if it is not used,
Then in the routers/router.go I changed the import path
"D:/Web Dev/GO/BeeGO/test-project/quickstart/controllers" to "../controllers"
It seems BeeGO doesn't generate the template properly and caused the build to fail.
Another possiblity for this error, is when you copy-paste code from the internet,
and
import "quickstart/routers"
became
import "quickstart/routers "
due to bugs in some CMS/Blog systems (notice the space at the end before the closing quote...).
I try to call the ExpFloat64() function of the rand package (http://golang.org/pkg/rand/). However, it gives following error "prog.go:4: imported and not used: rand prog.go:7: undefined: ExpFloat64". Can anybody help me why is it giving error ? Code given below.
package main
import "fmt"
import "rand"
func main() {
fmt.Println(ExpFloat64())
}
The error message explains it perfectly - in Go, you can't import packages and not use them. Here, it says you're importing rand and not using it, so either use it or don't import it. Your main function should be:
fmt.Println(rand.ExpFloat64())
To add to what Chris Bunch said, if you really wanted to use the names in the package (e.g. ExpFloat64) directly without using the package name, you can do this:
import . "rand"