all: improve the method of import for internal packages

1. Change directory structure and Makefile to let GOPATH=`pwd`, so wherever the project directory is, just use make to build.
This commit is contained in:
fatedier 2016-02-25 17:38:34 +08:00
parent f32cc7a840
commit 09127a3b55
17 changed files with 28 additions and 27 deletions

View File

@ -1,4 +1,5 @@
export PATH := $(GOPATH)/bin:$(PATH) export PATH := $(GOPATH)/bin:$(PATH)
export NEW_GOPATH := $(shell pwd)
all: build all: build
@ -9,13 +10,13 @@ godep:
godep restore godep restore
fmt: fmt:
@godep go fmt ./... @GOPATH=$(NEW_GOPATH) godep go fmt ./...
frps: frps:
godep go build -o bin/frps ./cmd/frps GOPATH=$(NEW_GOPATH) godep go build -o bin/frps ./src/frp/cmd/frps
frpc: frpc:
godep go build -o bin/frpc ./cmd/frpc GOPATH=$(NEW_GOPATH) godep go build -o bin/frpc ./src/frp/cmd/frpc
test: test:
@godep go test ./... @GOPATH=$(NEW_GOPATH) godep go test ./...

View File

@ -7,11 +7,11 @@ import (
"sync" "sync"
"time" "time"
"github.com/fatedier/frp/models/client" "frp/models/client"
"github.com/fatedier/frp/models/consts" "frp/models/consts"
"github.com/fatedier/frp/models/msg" "frp/models/msg"
"github.com/fatedier/frp/utils/conn" "frp/utils/conn"
"github.com/fatedier/frp/utils/log" "frp/utils/log"
) )
func ControlProcess(cli *client.ProxyClient, wait *sync.WaitGroup) { func ControlProcess(cli *client.ProxyClient, wait *sync.WaitGroup) {

View File

@ -4,8 +4,8 @@ import (
"os" "os"
"sync" "sync"
"github.com/fatedier/frp/models/client" "frp/models/client"
"github.com/fatedier/frp/utils/log" "frp/utils/log"
) )
func main() { func main() {

View File

@ -6,11 +6,11 @@ import (
"io" "io"
"time" "time"
"github.com/fatedier/frp/models/consts" "frp/models/consts"
"github.com/fatedier/frp/models/msg" "frp/models/msg"
"github.com/fatedier/frp/models/server" "frp/models/server"
"github.com/fatedier/frp/utils/conn" "frp/utils/conn"
"github.com/fatedier/frp/utils/log" "frp/utils/log"
) )
func ProcessControlConn(l *conn.Listener) { func ProcessControlConn(l *conn.Listener) {

View File

@ -3,9 +3,9 @@ package main
import ( import (
"os" "os"
"github.com/fatedier/frp/models/server" "frp/models/server"
"github.com/fatedier/frp/utils/conn" "frp/utils/conn"
"github.com/fatedier/frp/utils/log" "frp/utils/log"
) )
func main() { func main() {

View File

@ -3,10 +3,10 @@ package client
import ( import (
"encoding/json" "encoding/json"
"github.com/fatedier/frp/models/consts" "frp/models/consts"
"github.com/fatedier/frp/models/msg" "frp/models/msg"
"github.com/fatedier/frp/utils/conn" "frp/utils/conn"
"github.com/fatedier/frp/utils/log" "frp/utils/log"
) )
type ProxyClient struct { type ProxyClient struct {

View File

@ -5,9 +5,9 @@ import (
"sync" "sync"
"time" "time"
"github.com/fatedier/frp/models/consts" "frp/models/consts"
"github.com/fatedier/frp/utils/conn" "frp/utils/conn"
"github.com/fatedier/frp/utils/log" "frp/utils/log"
) )
type ProxyServer struct { type ProxyServer struct {

View File

@ -7,7 +7,7 @@ import (
"net" "net"
"sync" "sync"
"github.com/fatedier/frp/utils/log" "frp/utils/log"
) )
type Listener struct { type Listener struct {