Skip to content

Commit

Permalink
all: improve the method of import for internal packages
Browse files Browse the repository at this point in the history
1. Change directory structure and Makefile to let GOPATH=`pwd`, so wherever the project directory is, just use make to build.
  • Loading branch information
fatedier committed Feb 25, 2016
1 parent f32cc7a commit 09127a3
Show file tree
Hide file tree
Showing 17 changed files with 28 additions and 27 deletions.
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export PATH := $(GOPATH)/bin:$(PATH)
export NEW_GOPATH := $(shell pwd)

all: build

Expand All @@ -9,13 +10,13 @@ godep:
godep restore

fmt:
@godep go fmt ./...
@GOPATH=$(NEW_GOPATH) godep go fmt ./...

frps:
godep go build -o bin/frps ./cmd/frps
GOPATH=$(NEW_GOPATH) godep go build -o bin/frps ./src/frp/cmd/frps

frpc:
godep go build -o bin/frpc ./cmd/frpc
GOPATH=$(NEW_GOPATH) godep go build -o bin/frpc ./src/frp/cmd/frpc

test:
@godep go test ./...
@GOPATH=$(NEW_GOPATH) godep go test ./...
10 changes: 5 additions & 5 deletions cmd/frpc/control.go → src/frp/cmd/frpc/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"sync"
"time"

"github.com/fatedier/frp/models/client"
"github.com/fatedier/frp/models/consts"
"github.com/fatedier/frp/models/msg"
"github.com/fatedier/frp/utils/conn"
"github.com/fatedier/frp/utils/log"
"frp/models/client"
"frp/models/consts"
"frp/models/msg"
"frp/utils/conn"
"frp/utils/log"
)

func ControlProcess(cli *client.ProxyClient, wait *sync.WaitGroup) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/frpc/main.go → src/frp/cmd/frpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"os"
"sync"

"github.com/fatedier/frp/models/client"
"github.com/fatedier/frp/utils/log"
"frp/models/client"
"frp/utils/log"
)

func main() {
Expand Down
10 changes: 5 additions & 5 deletions cmd/frps/control.go → src/frp/cmd/frps/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"io"
"time"

"github.com/fatedier/frp/models/consts"
"github.com/fatedier/frp/models/msg"
"github.com/fatedier/frp/models/server"
"github.com/fatedier/frp/utils/conn"
"github.com/fatedier/frp/utils/log"
"frp/models/consts"
"frp/models/msg"
"frp/models/server"
"frp/utils/conn"
"frp/utils/log"
)

func ProcessControlConn(l *conn.Listener) {
Expand Down
6 changes: 3 additions & 3 deletions cmd/frps/main.go → src/frp/cmd/frps/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package main
import (
"os"

"github.com/fatedier/frp/models/server"
"github.com/fatedier/frp/utils/conn"
"github.com/fatedier/frp/utils/log"
"frp/models/server"
"frp/utils/conn"
"frp/utils/log"
)

func main() {
Expand Down
8 changes: 4 additions & 4 deletions models/client/client.go → src/frp/models/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package client
import (
"encoding/json"

"github.com/fatedier/frp/models/consts"
"github.com/fatedier/frp/models/msg"
"github.com/fatedier/frp/utils/conn"
"github.com/fatedier/frp/utils/log"
"frp/models/consts"
"frp/models/msg"
"frp/utils/conn"
"frp/utils/log"
)

type ProxyClient struct {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions models/server/server.go → src/frp/models/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"sync"
"time"

"github.com/fatedier/frp/models/consts"
"github.com/fatedier/frp/utils/conn"
"github.com/fatedier/frp/utils/log"
"frp/models/consts"
"frp/utils/conn"
"frp/utils/log"
)

type ProxyServer struct {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion utils/conn/conn.go → src/frp/utils/conn/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net"
"sync"

"github.com/fatedier/frp/utils/log"
"frp/utils/log"
)

type Listener struct {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 09127a3

Please sign in to comment.