I want to use the parquet-go lib (https://github.com/xitongsys/parquet-go) in my project, but I meet a problem when I build the project. The following is steps to reproduce the problems:
- Create a new project, named temp, add write the following code into main.go
package main
import (
"github.com/xitongsys/parquet-go/ParquetFile"
"github.com/xitongsys/parquet-go/ParquetWriter"
)
type Model struct {
F1 string `parquet:"name=name, type=UTF8"`
}
func main() {
// Write
fw, _ := ParquetFile.NewLocalFileWriter("/tmp/test.parquet")
pw, _ := ParquetWriter.NewParquetWriter(fw, new(Model), 4)
stu := Model{F1: "f1"}
pw.Write(stu)
fw.Close()
}
The code structure should be:
$GOPATH/src
|-- temp
|-- main.go
- Use “go get github.com/xitongsys/parquet-go/…” to download required libs. After this, the code structure should be:
$GOPATH/src
|-- cloud.google.com
|-- github.com
|-- go.opencensus.io
|-- golang.org
|-- google.golang.org
|-- gopkg.in
|-- temp
|-- main.go
-
Use “go build” to build the project. There will be no problem.
-
Copy all dependences into “vendor”:
$GOPATH/src
|-- cloud.google.com
|-- github.com
|-- go.opencensus.io
|-- golang.org
|-- google.golang.org
|-- gopkg.in
|-- temp
|-- main.go
|-- vendor
|-- cloud.google.com
|-- github.com
|-- go.opencensus.io
|-- golang.org
|-- google.golang.org
|-- gopkg.in
Then run “go build”, but it is failed as follows:
$ go build
vendor/github.com/colinmarc/hdfs/client.go:14:2: use of internal package github.com/colinmarc/hdfs/internal/protocol/hadoop_hdfs not allowed
vendor/github.com/colinmarc/hdfs/client.go:15:2: use of internal package github.com/colinmarc/hdfs/internal/rpc not allowed
- Then I delete all dependences under $GOPATH/src:
$GOPATH/src
|-- temp
|-- main.go
|-- vendor
|-- cloud.google.com
|-- github.com
|-- go.opencensus.io
|-- golang.org
|-- google.golang.org
|-- gopkg.in
Then run “go build”, but it is also failed with a different error:
$ go build
vendor/github.com/colinmarc/hdfs/client.go:13:2: cannot find package "github.com/colinmarc/hdfs/v2/hadoopconf" in any of:
/Users/jrliu/Projects/go_temp/src/temp/vendor/github.com/colinmarc/hdfs/v2/hadoopconf (vendor tree)
/usr/local/go/src/github.com/colinmarc/hdfs/v2/hadoopconf (from $GOROOT)
/Users/jrliu/Projects/go_temp/src/github.com/colinmarc/hdfs/v2/hadoopconf (from $GOPATH)
vendor/github.com/colinmarc/hdfs/client.go:14:2: cannot find package "github.com/colinmarc/hdfs/v2/internal/protocol/hadoop_hdfs" in any of:
/Users/jrliu/Projects/go_temp/src/temp/vendor/github.com/colinmarc/hdfs/v2/internal/protocol/hadoop_hdfs (vendor tree)
/usr/local/go/src/github.com/colinmarc/hdfs/v2/internal/protocol/hadoop_hdfs (from $GOROOT)
/Users/jrliu/Projects/go_temp/src/github.com/colinmarc/hdfs/v2/internal/protocol/hadoop_hdfs (from $GOPATH)
vendor/github.com/colinmarc/hdfs/client.go:15:2: cannot find package "github.com/colinmarc/hdfs/v2/internal/rpc" in any of:
/Users/jrliu/Projects/go_temp/src/temp/vendor/github.com/colinmarc/hdfs/v2/internal/rpc (vendor tree)
/usr/local/go/src/github.com/colinmarc/hdfs/v2/internal/rpc (from $GOROOT)
/Users/jrliu/Projects/go_temp/src/github.com/colinmarc/hdfs/v2/internal/rpc (from $GOPATH)
Can anyone help me to figure out the problem? I will very appreciate that!
$ go version
go version go1.12 darwin/amd64