csvqのbuild
- リンクを取得
- ×
- メール
- 他のアプリ
使おうと思ったら、無かった…
Installation
Install executable binaryDownload an archive file from release page.
Extract the downloaded archive and add a binary file in it to your path.
Build from source
Requirements
Go 1.11 or later (ref. Getting Started - The Go Programming Language)
Build with one of the following ways
Use go get
$ go get github.com/mithrandie/csvq
Build with strict dependencies
$ go get -d github.com/mithrandie/csvq
Change directory to $GOPATH/src/github.com/mithrandie/csvq
$ env GO111MODULE=on go install
githubに書かれているとおりに、
$ go get github.com/mithrandie/csvq
すると、以下のようなエラーが大量に…。
$ go get github.com/mithrandie/csvq
# github.com/mithrandie/csvq
../../go/src/github.com/mithrandie/csvq/main.go:35:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:39:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:44:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:48:15: cannot use cli.BoolFlag literal (type cli.BoolFlag) as type cli.Flag in slice literal:
cli.BoolFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:52:18: cannot use cli.Float64Flag literal (type cli.Float64Flag) as type cli.Flag in slice literal:
cli.Float64Flag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:57:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:61:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:66:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:71:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:75:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:75:17: too many errors
こんな情報をゲット。
良くわからないが、該当する行を全て書き換えてみる。
main.goのAppFlag内のcli.〜に該当する部分を全て&を先頭に付加。
保存して、buildしてみる。
$ make
GOPATH=/home/yoshimura/go/src/github.com/mithrandie/csvq/build go build -ldflags="-X github.com/mithrandie/csvq/lib/query.Version=v1.13.3-3-g119a62d" -o /home/yoshimura/go/src/github.com/mithrandie/csvq/build/bin/csvq
go: downloading github.com/urfave/cli v1.20.0
go: downloading github.com/mithrandie/ternary v1.1.0
go: downloading github.com/mithrandie/go-text v1.3.1
go: downloading github.com/mitchellh/go-homedir v1.0.0
go: downloading github.com/mithrandie/go-file/v2 v2.0.2
go: downloading golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869
go: downloading github.com/mithrandie/readline-csvq v1.1.1
go: downloading golang.org/x/text v0.3.1
go: downloading golang.org/x/sys v0.0.0-20191029155521-f43be2a4598c
おっ!無事に通った。
build/bin/ を確認すると、csvqが出来上がっている。
念の為、バージョンを確認。
$ ./csvq -v
csvq version v1.13.3-3-g119a62d
ちゃんと、出来上がっているようだ。
helpもInteractiveモードも動作する。
試しに、test.csvを作成し、SQLを叩いてみる。
https://qiita.com/mithrandie/items/146564e748ee235709c0
$ ./csvq
> select * from `test.csv`
+----+------------------+-----------+
| id | name | parent_id |
+----+------------------+-----------+
| 1 | ラダトーム | NULL |
| 2 | りゅうおうのしろ | NULL |
| 3 | ガライ | 1 |
| 4 | マイラ | 1 |
| 5 | リムルダール | 1 |
| 6 | ドムドーラ | 1 |
| 7 | メルキド | 1 |
| 8 | あめのほこら | 4 |
| 9 | せいなるほこら | 5 |
+----+------------------+-----------+
コメント
コメントを投稿
励みになりますので、簡単で良いので一言くださいませ。