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

3
.gitignore vendored
View File

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

View File

@ -14,14 +14,11 @@ export GO_BUILD_TAGS
all: build all: build
build: build:
$(GO) install -tags '$(GO_BUILD_TAGS)' ./... $(GO) install -tags 'linenoise $(GO_BUILD_TAGS)' ./...
build_use_lmdb: build_use_lmdb:
$(GO) install -tags '$(GO_BUILD_TAGS) lmdb' ./... $(GO) install -tags 'linenoise $(GO_BUILD_TAGS) lmdb' ./...
clean:
$(GO) clean -i ./...
test: test:
$(GO) test --race -tags '$(GO_BUILD_TAGS)' ./... $(GO) test --race -tags '$(GO_BUILD_TAGS)' ./...
@ -40,5 +37,8 @@ test_store:
test_rpl: test_rpl:
$(GO) test --race -tags '$(GO_BUILD_TAGS)' ./rpl $(GO) test --race -tags '$(GO_BUILD_TAGS)' ./rpl
clean:
$(GO) clean -i ./...
fmt: fmt:
go 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,4 +1,4 @@
//This file was generated by .tools/generate_commands.py on Thu Mar 05 2015 15:42:49 +0800 //This file was generated by .tools/generate_commands.py on Thu Mar 05 2015 15:42:49 +0800
package main package main
var helpCommands = [][]string{ var helpCommands = [][]string{

View File

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

View File

@ -1,3 +1,5 @@
// +build linenoise
package main package main
//#include <stdlib.h> //#include <stdlib.h>
@ -47,21 +49,6 @@ func setHistoryCapacity(capacity int) error {
return nil 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 { // typedef struct linenoiseCompletions {
// size_t len; // size_t len;
// char **cvec; // char **cvec;

View File

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

View File

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

View File

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

View File

@ -1,3 +1,5 @@
// +build linenoise
package main package main
import ( 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")
}