add linenoise build tag

avoid some cgo compiling problem
This commit is contained in:
siddontang 2015-03-12 11:32:33 +08:00
parent 5f0c295dd5
commit 2d113aa9be
11 changed files with 42 additions and 23 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ nohup.out
build_config.mk
var*
*.log
bin

View File

@ -14,13 +14,10 @@ export GO_BUILD_TAGS
all: build
build:
$(GO) install -tags '$(GO_BUILD_TAGS)' ./...
$(GO) install -tags 'linenoise $(GO_BUILD_TAGS)' ./...
build_use_lmdb:
$(GO) install -tags '$(GO_BUILD_TAGS) lmdb' ./...
clean:
$(GO) clean -i ./...
$(GO) install -tags 'linenoise $(GO_BUILD_TAGS) lmdb' ./...
test:
$(GO) test --race -tags '$(GO_BUILD_TAGS)' ./...
@ -40,5 +37,8 @@ test_store:
test_rpl:
$(GO) test --race -tags '$(GO_BUILD_TAGS)' ./rpl
clean:
$(GO) clean -i ./...
fmt:
go fmt ./...

View File

@ -0,0 +1,16 @@
package main
// CompletionHandler provides possible completions for given input
type CompletionHandler func(input string) []string
// DefaultCompletionHandler simply returns an empty slice.
var DefaultCompletionHandler = func(input string) []string {
return make([]string, 0)
}
var complHandler = DefaultCompletionHandler
// SetCompletionHandler sets the CompletionHandler to be used for completion
func SetCompletionHandler(c CompletionHandler) {
complHandler = c
}

View File

@ -1,3 +1,5 @@
// +build linenoise
/* linenoise.c -- guerrilla line editing library against the idea that a
* line editing lib needs to be 20,000 lines of C code.
*

View File

@ -1,3 +1,5 @@
// +build linenoise
package main
//#include <stdlib.h>
@ -47,21 +49,6 @@ func setHistoryCapacity(capacity int) error {
return nil
}
// CompletionHandler provides possible completions for given input
type CompletionHandler func(input string) []string
// DefaultCompletionHandler simply returns an empty slice.
var DefaultCompletionHandler = func(input string) []string {
return make([]string, 0)
}
var complHandler = DefaultCompletionHandler
// SetCompletionHandler sets the CompletionHandler to be used for completion
func SetCompletionHandler(c CompletionHandler) {
complHandler = c
}
// typedef struct linenoiseCompletions {
// size_t len;
// char **cvec;

View File

@ -1,3 +1,5 @@
// +build linenoise
/* linenoise.h -- guerrilla line editing library against the idea that a
* line editing lib needs to be 20,000 lines of C code.
*

View File

@ -1,3 +1,4 @@
// +build linenoise
#include "linenoiseCompletionCallbackHook.h"

View File

@ -1,3 +1,4 @@
// +build linenoise
#include <stdlib.h>
#include "linenoise.h"

View File

@ -1,3 +1,5 @@
// +build linenoise
package main
import (

View File

@ -0,0 +1,7 @@
// +build !linenoise
package main
func main() {
println("Please use linenoise to build again, or use redis-cli instead")
}