Skip to content

Commit

Permalink
Add go install
Browse files Browse the repository at this point in the history
  • Loading branch information
auxten committed May 25, 2024
1 parent 51ac27d commit 02e1c55
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/chdb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Test
run: make test
- name: Test main
run: LD_LIBRARY_PATH=./ ./chdb-go "SELECT 12345"
run: ./chdb-go "SELECT 12345"

build_mac:
runs-on: macos-12
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
go mod tidy
make build
- name: Test
run: LD_LIBRARY_PATH=. ./chdb-go "SELECT 12345"
run: ./chdb-go "SELECT 12345"
- name: Get Version
run: |
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ update_libchdb:
./update_libchdb.sh

install:
curl -sL https://lib.chdb.io | sudo bash
curl -sL https://lib.chdb.io | bash

test:
CGO_ENABLED=1 go test -v -coverprofile=coverage.out ./...
Expand All @@ -13,4 +13,4 @@ run:
CGO_ENABLED=1 go run main.go

build:
CGO_ENABLED=1 go build -o chdb-go main.go
CGO_ENABLED=1 go build -ldflags '-extldflags "-Wl,-rpath,/usr/local/lib"' -o chdb-go main.go
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@

## Install

1. Download and install [`libchdb`](https://github.com/chdb-io/chdb/releases)
- run `make update_libchdb` to download and extract libchdb.so. or
- run `make install` to install libchdb.so
2. Build `chdb-go`
### Install libchdb.so
1. Install [`libchdb`](https://github.com/chdb-io/chdb/releases)
- curl -sL https://lib.chdb.io | bash

### Install chdb-go
1. Install `chdb-go`
- `go install github.com/chdb-io/chdb-go@latest`
2. Run `chdb-go` with or without persistent `--path`
- run `$GOPATH/bin/chdb-go`

### or Build from source
1. Build `chdb-go`
- run `make build`
3. Run `chdb-go` with or without persistent `--path`
2. Run `chdb-go` with or without persistent `--path`
- run `./chdb-go`

## chdb-go CLI
Expand Down
2 changes: 1 addition & 1 deletion chdbstable/chdb.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package chdbstable

/*
#cgo LDFLAGS: -L. -lchdb
#cgo LDFLAGS: -L/usr/local/lib -lchdb
#include <stdlib.h> // Include the C standard library for C.free
#include "chdb.h"
*/
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/chdb-io/chdb-go

go 1.21.5
go 1.21

require (
github.com/apache/arrow/go/v14 v14.0.2
Expand Down

0 comments on commit 02e1c55

Please sign in to comment.