Commit 646de543 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Be compatible with GOPATH

parent 285f47a7
...@@ -4,3 +4,4 @@ testdata/scratch ...@@ -4,3 +4,4 @@ testdata/scratch
testdata/public testdata/public
gitlab-zip-cat gitlab-zip-cat
gitlab-zip-metadata gitlab-zip-metadata
_build
PREFIX=/usr/local PREFIX=/usr/local
VERSION=$(shell git describe)-$(shell date -u +%Y%m%d.%H%M%S) VERSION=$(shell git describe)-$(shell date -u +%Y%m%d.%H%M%S)
GOBUILD=go build -ldflags "-X main.Version=${VERSION}" GOPATH=$(shell pwd)/_build
GOBUILD=GOPATH=${GOPATH} go build -ldflags "-X main.Version=${VERSION}"
PKG=gitlab.com/gitlab-org/gitlab-workhorse
all: gitlab-zip-cat gitlab-zip-metadata gitlab-workhorse all: clean-build gitlab-zip-cat gitlab-zip-metadata gitlab-workhorse
gitlab-zip-cat: $(shell find cmd/gitlab-zip-cat/ -name '*.go') gitlab-zip-cat: _build $(shell find cmd/gitlab-zip-cat/ -name '*.go')
${GOBUILD} -o $@ ./cmd/$@ ${GOBUILD} -o $@ ${PKG}/cmd/$@
gitlab-zip-metadata: $(shell find cmd/gitlab-zip-metadata/ -name '*.go') gitlab-zip-metadata: _build $(shell find cmd/gitlab-zip-metadata/ -name '*.go')
${GOBUILD} -o $@ ./cmd/$@ ${GOBUILD} -o $@ ${PKG}/cmd/$@
gitlab-workhorse: $(shell find . -name '*.go') gitlab-workhorse: _build $(shell find . -name '*.go' | grep -v '^\./_')
${GOBUILD} -o $@ ${GOBUILD} -o $@ ${PKG}
install: gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata install: gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
mkdir -p $(DESTDIR)${PREFIX}/bin/ mkdir -p $(DESTDIR)${PREFIX}/bin/
install gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata ${DESTDIR}${PREFIX}/bin/ install gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata ${DESTDIR}${PREFIX}/bin/
_build:
mkdir -p $@/src/${PKG}
tar -cf - --exclude src --exclude .git . | \
(cd $@/src/${PKG} && tar -xf -)
touch $@
.PHONY: test .PHONY: test
test: testdata/data/group/test.git clean-workhorse all test: testdata/data/group/test.git clean-build clean-workhorse all
go fmt ./... | awk '{ print } END { if (NR > 0) { print "Please run go fmt"; exit 1 } }' GOPATH=${GOPATH} go fmt ${PKG}/... | awk '{ print } END { if (NR > 0) { print "Please run go fmt"; exit 1 } }'
support/path go test ./... GOPATH=${GOPATH} support/path go test ${PKG}/...
@echo SUCCESS @echo SUCCESS
coverage: testdata/data/group/test.git coverage: testdata/data/group/test.git
...@@ -38,9 +46,13 @@ testdata/data: ...@@ -38,9 +46,13 @@ testdata/data:
mkdir -p $@ mkdir -p $@
.PHONY: clean .PHONY: clean
clean: clean-workhorse clean: clean-workhorse clean-build
rm -rf testdata/data testdata/scratch rm -rf testdata/data testdata/scratch
.PHONY: clean-workhorse .PHONY: clean-workhorse
clean-workhorse: clean-workhorse:
rm -f gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata rm -f gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
.PhONY: clean-build
clean-build:
rm -rf _build
\ No newline at end of file
package main package main
import ( import (
"./internal/api"
"./internal/helper"
"./internal/testhelper"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"regexp" "regexp"
......
package main package main
import ( import (
"../../internal/zipartifacts"
"archive/zip" "archive/zip"
"flag" "flag"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
"io" "io"
"os" "os"
) )
......
package main package main
import ( import (
"../../internal/zipartifacts"
"flag" "flag"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
"os" "os"
) )
......
package api package api
import ( import (
"../badgateway"
"../helper"
"encoding/json" "encoding/json"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"io" "io"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
......
package artifacts package artifacts
import ( import (
"../api"
"../helper"
"../zipartifacts"
"bufio" "bufio"
"errors" "errors"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
"io" "io"
"mime" "mime"
"net/http" "net/http"
......
package artifacts package artifacts
import ( import (
"../api"
"../helper"
"../testhelper"
"archive/zip" "archive/zip"
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
......
package artifacts package artifacts
import ( import (
"../api"
"../helper"
"../upload"
"../zipartifacts"
"errors" "errors"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/upload"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
"io/ioutil" "io/ioutil"
"mime/multipart" "mime/multipart"
"net/http" "net/http"
......
package artifacts package artifacts
import ( import (
"../api"
"../helper"
"../proxy"
"../testhelper"
"../zipartifacts"
"archive/zip" "archive/zip"
"bytes" "bytes"
"compress/gzip" "compress/gzip"
"encoding/json" "encoding/json"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/proxy"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
"io" "io"
"io/ioutil" "io/ioutil"
"mime/multipart" "mime/multipart"
......
package badgateway package badgateway
import ( import (
"../helper"
"bytes" "bytes"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"io/ioutil" "io/ioutil"
"net" "net"
"net/http" "net/http"
......
...@@ -5,9 +5,9 @@ In this file we handle 'git archive' downloads ...@@ -5,9 +5,9 @@ In this file we handle 'git archive' downloads
package git package git
import ( import (
"../helper"
"../senddata"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata"
"io" "io"
"io/ioutil" "io/ioutil"
"log" "log"
......
package git package git
import ( import (
"../helper"
"../senddata"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata"
"io" "io"
"log" "log"
"net/http" "net/http"
......
...@@ -5,11 +5,11 @@ In this file we handle the Git 'smart HTTP' protocol ...@@ -5,11 +5,11 @@ In this file we handle the Git 'smart HTTP' protocol
package git package git
import ( import (
"../api"
"../delay"
"../helper"
"errors" "errors"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/delay"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"io" "io"
"log" "log"
"net/http" "net/http"
......
...@@ -5,13 +5,13 @@ In this file we handle git lfs objects downloads and uploads ...@@ -5,13 +5,13 @@ In this file we handle git lfs objects downloads and uploads
package lfs package lfs
import ( import (
"../api"
"../helper"
"bytes" "bytes"
"crypto/sha256" "crypto/sha256"
"encoding/hex" "encoding/hex"
"errors" "errors"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"io" "io"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
......
package proxy package proxy
import ( import (
"../badgateway" "gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway"
"../helper" "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"net/http" "net/http"
"net/http/httputil" "net/http/httputil"
"net/url" "net/url"
......
...@@ -7,7 +7,7 @@ via the X-Sendfile mechanism. All that is needed in the Rails code is the ...@@ -7,7 +7,7 @@ via the X-Sendfile mechanism. All that is needed in the Rails code is the
package sendfile package sendfile
import ( import (
"../helper" "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"log" "log"
"net/http" "net/http"
) )
......
package staticpages package staticpages
import ( import (
"../helper" "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"path/filepath" "path/filepath"
......
package staticpages package staticpages
import ( import (
"../testhelper" "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
......
package staticpages package staticpages
import ( import (
"../helper"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"io/ioutil" "io/ioutil"
"log" "log"
"net/http" "net/http"
......
package staticpages package staticpages
import ( import (
"../testhelper"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
......
package staticpages package staticpages
import ( import (
"../helper" "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"../urlprefix" "gitlab.com/gitlab-org/gitlab-workhorse/internal/urlprefix"
"log" "log"
"net/http" "net/http"
"os" "os"
......
package staticpages package staticpages
import ( import (
"../testhelper"
"bytes" "bytes"
"compress/gzip" "compress/gzip"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
......
package upload package upload
import ( import (
"../helper"
"bytes" "bytes"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"io" "io"
"io/ioutil" "io/ioutil"
"mime/multipart" "mime/multipart"
......
package upload package upload
import ( import (
"../helper"
"../proxy"
"../testhelper"
"bytes" "bytes"
"errors" "errors"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/proxy"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
"io" "io"
"io/ioutil" "io/ioutil"
"mime/multipart" "mime/multipart"
......
package upstream package upstream
import ( import (
"../testhelper" "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"testing" "testing"
......
package upstream package upstream
import ( import (
"../helper"
"compress/gzip" "compress/gzip"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"io" "io"
"net/http" "net/http"
) )
......
package upstream package upstream
import ( import (
"../testhelper"
"bytes" "bytes"
"compress/gzip" "compress/gzip"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
......
package upstream package upstream
import ( import (
apipkg "../api" apipkg "gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"../artifacts" "gitlab.com/gitlab-org/gitlab-workhorse/internal/artifacts"
"../git" "gitlab.com/gitlab-org/gitlab-workhorse/internal/git"
"../lfs" "gitlab.com/gitlab-org/gitlab-workhorse/internal/lfs"
proxypkg "../proxy" proxypkg "gitlab.com/gitlab-org/gitlab-workhorse/internal/proxy"
"../senddata" "gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata"
"../sendfile" "gitlab.com/gitlab-org/gitlab-workhorse/internal/sendfile"
"../staticpages" "gitlab.com/gitlab-org/gitlab-workhorse/internal/staticpages"
"net/http" "net/http"
"regexp" "regexp"
) )
......
...@@ -7,10 +7,10 @@ In this file we handle request routing and interaction with the authBackend. ...@@ -7,10 +7,10 @@ In this file we handle request routing and interaction with the authBackend.
package upstream package upstream
import ( import (
"../badgateway"
"../helper"
"../urlprefix"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/urlprefix"
"net/http" "net/http"
"net/url" "net/url"
"strings" "strings"
......
...@@ -14,9 +14,9 @@ In this file we start the web server and hand off to the upstream type. ...@@ -14,9 +14,9 @@ In this file we start the web server and hand off to the upstream type.
package main package main
import ( import (
"./internal/upstream"
"flag" "flag"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream"
"log" "log"
"net" "net"
"net/http" "net/http"
......
package main package main
import ( import (
"./internal/api"
"./internal/helper"
"./internal/testhelper"
"./internal/upstream"
"bytes" "bytes"
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream"
"io" "io"
"io/ioutil" "io/ioutil"
"log" "log"
......
package main package main
import ( import (
"./internal/badgateway"
"./internal/helper"
"./internal/proxy"
"./internal/testhelper"
"bytes" "bytes"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/proxy"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
"io" "io"
"net" "net"
"net/http" "net/http"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment