Commit d44febe6 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Separate imports

parent 85692df5
...@@ -2,13 +2,14 @@ package main ...@@ -2,13 +2,14 @@ package main
import ( import (
"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"
"testing" "testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
) )
func okHandler(w http.ResponseWriter, _ *http.Request, _ *api.Response) { func okHandler(w http.ResponseWriter, _ *http.Request, _ *api.Response) {
......
...@@ -4,9 +4,10 @@ import ( ...@@ -4,9 +4,10 @@ import (
"archive/zip" "archive/zip"
"flag" "flag"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
"io" "io"
"os" "os"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
) )
const progName = "gitlab-zip-cat" const progName = "gitlab-zip-cat"
......
...@@ -3,8 +3,9 @@ package main ...@@ -3,8 +3,9 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
"os" "os"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
) )
const progName = "gitlab-zip-metadata" const progName = "gitlab-zip-metadata"
......
...@@ -3,13 +3,14 @@ package api ...@@ -3,13 +3,14 @@ package api
import ( import (
"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"
"net/url" "net/url"
"strings" "strings"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
) )
type API struct { type API struct {
......
...@@ -4,9 +4,6 @@ import ( ...@@ -4,9 +4,6 @@ import (
"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"
...@@ -15,6 +12,10 @@ import ( ...@@ -15,6 +12,10 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"syscall" "syscall"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
) )
func detectFileContentType(fileName string) string { func detectFileContentType(fileName string) string {
......
...@@ -5,14 +5,15 @@ import ( ...@@ -5,14 +5,15 @@ import (
"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"
"os" "os"
"testing" "testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
) )
func testArtifactDownloadServer(t *testing.T, archive string, entry string) *httptest.Server { func testArtifactDownloadServer(t *testing.T, archive string, entry string) *httptest.Server {
......
...@@ -3,16 +3,17 @@ package artifacts ...@@ -3,16 +3,17 @@ package artifacts
import ( import (
"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"
"os" "os"
"os/exec" "os/exec"
"syscall" "syscall"
"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"
) )
type artifactsUploadProcessor struct { type artifactsUploadProcessor struct {
......
...@@ -6,11 +6,6 @@ import ( ...@@ -6,11 +6,6 @@ import (
"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"
...@@ -18,6 +13,12 @@ import ( ...@@ -18,6 +13,12 @@ import (
"net/http/httptest" "net/http/httptest"
"os" "os"
"testing" "testing"
"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"
) )
func testArtifactsUploadServer(t *testing.T, tempPath string) *httptest.Server { func testArtifactsUploadServer(t *testing.T, tempPath string) *httptest.Server {
......
...@@ -3,11 +3,12 @@ package badgateway ...@@ -3,11 +3,12 @@ package badgateway
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"io/ioutil" "io/ioutil"
"net" "net"
"net/http" "net/http"
"time" "time"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
) )
// Values from http.DefaultTransport // Values from http.DefaultTransport
......
...@@ -6,8 +6,6 @@ package git ...@@ -6,8 +6,6 @@ package git
import ( import (
"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"
...@@ -18,6 +16,9 @@ import ( ...@@ -18,6 +16,9 @@ import (
"path/filepath" "path/filepath"
"syscall" "syscall"
"time" "time"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata"
) )
type archive struct{ senddata.Prefix } type archive struct{ senddata.Prefix }
......
...@@ -2,12 +2,13 @@ package git ...@@ -2,12 +2,13 @@ package git
import ( import (
"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"
"strings" "strings"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata"
) )
type blob struct{ senddata.Prefix } type blob struct{ senddata.Prefix }
......
...@@ -7,9 +7,6 @@ package git ...@@ -7,9 +7,6 @@ package git
import ( import (
"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"
...@@ -17,6 +14,10 @@ import ( ...@@ -17,6 +14,10 @@ import (
"path" "path"
"path/filepath" "path/filepath"
"strings" "strings"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/delay"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
) )
func GetInfoRefs(a *api.API) http.Handler { func GetInfoRefs(a *api.API) http.Handler {
......
...@@ -10,13 +10,14 @@ import ( ...@@ -10,13 +10,14 @@ import (
"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"
"os" "os"
"path/filepath" "path/filepath"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
) )
func PutStore(a *api.API, h http.Handler) http.Handler { func PutStore(a *api.API, h http.Handler) http.Handler {
......
package proxy package proxy
import ( import (
"gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"net/http" "net/http"
"net/http/httputil" "net/http/httputil"
"net/url" "net/url"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
) )
type Proxy struct { type Proxy struct {
......
...@@ -7,9 +7,10 @@ via the X-Sendfile mechanism. All that is needed in the Rails code is the ...@@ -7,9 +7,10 @@ via the X-Sendfile mechanism. All that is needed in the Rails code is the
package sendfile package sendfile
import ( import (
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"log" "log"
"net/http" "net/http"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
) )
const sendFileResponseHeader = "X-Sendfile" const sendFileResponseHeader = "X-Sendfile"
......
package staticpages package staticpages
import ( import (
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"path/filepath" "path/filepath"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
) )
func (s *Static) DeployPage(handler http.Handler) http.Handler { func (s *Static) DeployPage(handler http.Handler) http.Handler {
......
...@@ -2,13 +2,14 @@ package staticpages ...@@ -2,13 +2,14 @@ package staticpages
import ( import (
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"os" "os"
"path/filepath" "path/filepath"
"testing" "testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
) )
func TestIfErrorPageIsPresented(t *testing.T) { func TestIfErrorPageIsPresented(t *testing.T) {
......
package staticpages package staticpages
import ( import (
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/urlprefix"
"log" "log"
"net/http" "net/http"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"time" "time"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/urlprefix"
) )
type CacheMode int type CacheMode int
......
...@@ -3,13 +3,14 @@ package staticpages ...@@ -3,13 +3,14 @@ package staticpages
import ( import (
"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"
"os" "os"
"path/filepath" "path/filepath"
"testing" "testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
) )
func TestServingNonExistingFile(t *testing.T) { func TestServingNonExistingFile(t *testing.T) {
......
...@@ -3,12 +3,13 @@ package upload ...@@ -3,12 +3,13 @@ package upload
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"io" "io"
"io/ioutil" "io/ioutil"
"mime/multipart" "mime/multipart"
"net/http" "net/http"
"os" "os"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
) )
type MultipartFormProcessor interface { type MultipartFormProcessor interface {
......
...@@ -4,9 +4,6 @@ import ( ...@@ -4,9 +4,6 @@ import (
"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"
...@@ -16,6 +13,10 @@ import ( ...@@ -16,6 +13,10 @@ import (
"regexp" "regexp"
"strings" "strings"
"testing" "testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/proxy"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
) )
var nilHandler = http.HandlerFunc(func(http.ResponseWriter, *http.Request) {}) var nilHandler = http.HandlerFunc(func(http.ResponseWriter, *http.Request) {})
......
package upstream package upstream
import ( import (
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"testing" "testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
) )
func TestDevelopmentModeEnabled(t *testing.T) { func TestDevelopmentModeEnabled(t *testing.T) {
......
...@@ -3,9 +3,10 @@ package upstream ...@@ -3,9 +3,10 @@ package upstream
import ( import (
"compress/gzip" "compress/gzip"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"io" "io"
"net/http" "net/http"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
) )
func contentEncodingHandler(h http.Handler) http.Handler { func contentEncodingHandler(h http.Handler) http.Handler {
......
...@@ -4,12 +4,13 @@ import ( ...@@ -4,12 +4,13 @@ import (
"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"
"reflect" "reflect"
"testing" "testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
) )
func TestGzipEncoding(t *testing.T) { func TestGzipEncoding(t *testing.T) {
......
package upstream package upstream
import ( import (
"net/http"
"regexp"
apipkg "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" apipkg "gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/artifacts" "gitlab.com/gitlab-org/gitlab-workhorse/internal/artifacts"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/git" "gitlab.com/gitlab-org/gitlab-workhorse/internal/git"
...@@ -9,8 +12,6 @@ import ( ...@@ -9,8 +12,6 @@ import (
"gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata" "gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/sendfile" "gitlab.com/gitlab-org/gitlab-workhorse/internal/sendfile"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/staticpages" "gitlab.com/gitlab-org/gitlab-workhorse/internal/staticpages"
"net/http"
"regexp"
) )
type route struct { type route struct {
......
...@@ -8,13 +8,14 @@ package upstream ...@@ -8,13 +8,14 @@ package upstream
import ( import (
"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"
"time" "time"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/urlprefix"
) )
var DefaultBackend = helper.URLMustParse("http://localhost:8080") var DefaultBackend = helper.URLMustParse("http://localhost:8080")
......
...@@ -16,7 +16,6 @@ package main ...@@ -16,7 +16,6 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream"
"log" "log"
"net" "net"
"net/http" "net/http"
...@@ -24,6 +23,8 @@ import ( ...@@ -24,6 +23,8 @@ import (
"os" "os"
"syscall" "syscall"
"time" "time"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream"
) )
// Current version of GitLab Workhorse // Current version of GitLab Workhorse
......
...@@ -5,10 +5,6 @@ import ( ...@@ -5,10 +5,6 @@ import (
"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"
...@@ -22,6 +18,11 @@ import ( ...@@ -22,6 +18,11 @@ import (
"strings" "strings"
"testing" "testing"
"time" "time"
"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"
) )
const scratchDir = "testdata/scratch" const scratchDir = "testdata/scratch"
......
...@@ -3,10 +3,6 @@ package main ...@@ -3,10 +3,6 @@ package main
import ( import (
"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"
...@@ -14,6 +10,11 @@ import ( ...@@ -14,6 +10,11 @@ import (
"regexp" "regexp"
"testing" "testing"
"time" "time"
"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"
) )
func newProxy(url string, rt *badgateway.RoundTripper) *proxy.Proxy { func newProxy(url string, rt *badgateway.RoundTripper) *proxy.Proxy {
......
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