From 949ae84068cf31c15c35a889894cf06383daa635 Mon Sep 17 00:00:00 2001 From: tavit ohanian Date: Sat, 21 Aug 2021 06:25:20 -0400 Subject: [PATCH] refactor after forking multiformats --- cli/cmd_suggestion.go | 2 +- cli/helptext.go | 2 +- cli/helptext_test.go | 2 +- cli/parse.go | 6 +++--- cli/parse_test.go | 4 ++-- cli/responseemitter.go | 2 +- cli/responseemitter_test.go | 2 +- cli/run.go | 2 +- cli/run_test.go | 2 +- cli/single_test.go | 2 +- command.go | 4 ++-- doc.go | 2 +- examples/adder/cmd.go | 4 ++-- examples/adder/local/main.go | 6 +++--- examples/adder/remote/client/main.go | 10 +++++----- examples/adder/remote/server/main.go | 4 ++-- go.mod | 6 +++--- go.sum | 12 ++++++++---- http/client.go | 4 ++-- http/client_test.go | 2 +- http/config.go | 2 +- http/errors_test.go | 2 +- http/flushfwd.go | 2 +- http/handler.go | 6 +++--- http/handler_test.go | 4 ++-- http/http_test.go | 4 ++-- http/parse.go | 6 +++--- http/parse_test.go | 2 +- http/reforigin_test.go | 2 +- http/response.go | 2 +- http/response_test.go | 2 +- http/responseemitter.go | 4 ++-- request.go | 2 +- 33 files changed, 62 insertions(+), 58 deletions(-) diff --git a/cli/cmd_suggestion.go b/cli/cmd_suggestion.go index 096da49..2454b35 100644 --- a/cli/cmd_suggestion.go +++ b/cli/cmd_suggestion.go @@ -6,7 +6,7 @@ import ( "strings" levenshtein "github.com/texttheater/golang-levenshtein/levenshtein" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) // Make a custom slice that can be sorted by its levenshtein value diff --git a/cli/helptext.go b/cli/helptext.go index 8c88b33..64465de 100644 --- a/cli/helptext.go +++ b/cli/helptext.go @@ -9,7 +9,7 @@ import ( "strings" "text/template" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" "golang.org/x/crypto/ssh/terminal" ) diff --git a/cli/helptext_test.go b/cli/helptext_test.go index e59db69..3e51b2c 100644 --- a/cli/helptext_test.go +++ b/cli/helptext_test.go @@ -4,7 +4,7 @@ import ( "strings" "testing" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) func TestSynopsisGenerator(t *testing.T) { diff --git a/cli/parse.go b/cli/parse.go index 2d283fb..eb8d8e9 100644 --- a/cli/parse.go +++ b/cli/parse.go @@ -12,9 +12,9 @@ import ( "strings" osh "github.com/Kubuxu/go-os-helper" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" - files "gitlab.dms3.io/dms3/public/go-dms3-files" - logging "gitlab.dms3.io/dms3/public/go-log" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" + files "gitlab.dms3.io/dms3/go-dms3-files" + logging "gitlab.dms3.io/dms3/go-log" ) var log = logging.Logger("cmds/cli") diff --git a/cli/parse_test.go b/cli/parse_test.go index 9ddfd1d..8a43d81 100644 --- a/cli/parse_test.go +++ b/cli/parse_test.go @@ -11,9 +11,9 @@ import ( "strings" "testing" - files "gitlab.dms3.io/dms3/public/go-dms3-files" + files "gitlab.dms3.io/dms3/go-dms3-files" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) type kvs map[string]interface{} diff --git a/cli/responseemitter.go b/cli/responseemitter.go index 821aa8c..bd2ac18 100644 --- a/cli/responseemitter.go +++ b/cli/responseemitter.go @@ -7,7 +7,7 @@ import ( "os" "sync" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) var _ ResponseEmitter = &responseEmitter{} diff --git a/cli/responseemitter_test.go b/cli/responseemitter_test.go index 4daf809..8882cb2 100644 --- a/cli/responseemitter_test.go +++ b/cli/responseemitter_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) type tcCloseWithError struct { diff --git a/cli/run.go b/cli/run.go index 3aa3195..fd6faa5 100644 --- a/cli/run.go +++ b/cli/run.go @@ -8,7 +8,7 @@ import ( "strings" "time" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) // ExitError is the error used when a specific exit code needs to be returned. diff --git a/cli/run_test.go b/cli/run_test.go index 176acb3..f39f7c1 100644 --- a/cli/run_test.go +++ b/cli/run_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) var root = &cmds.Command{ diff --git a/cli/single_test.go b/cli/single_test.go index 4bf8a29..293b86e 100644 --- a/cli/single_test.go +++ b/cli/single_test.go @@ -5,7 +5,7 @@ import ( "context" "testing" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) func TestSingle(t *testing.T) { diff --git a/command.go b/command.go index 034d3f6..51661c6 100644 --- a/command.go +++ b/command.go @@ -13,9 +13,9 @@ import ( "fmt" "strings" - files "gitlab.dms3.io/dms3/public/go-dms3-files" + files "gitlab.dms3.io/dms3/go-dms3-files" - logging "gitlab.dms3.io/dms3/public/go-log" + logging "gitlab.dms3.io/dms3/go-log" ) // DefaultOutputEncoding defines the default API output encoding. diff --git a/doc.go b/doc.go index 55e9af7..b5a268f 100644 --- a/doc.go +++ b/doc.go @@ -87,7 +87,7 @@ To get a better idea of what's going on, take a look at the examples at - https://gitlab.dms3.io/dms3/public/go-dms3-cmds/tree/master/examples. + https://gitlab.dms3.io/dms3/go-dms3-cmds/tree/master/examples. */ package cmds diff --git a/examples/adder/cmd.go b/examples/adder/cmd.go index 3f8aefe..5e36074 100644 --- a/examples/adder/cmd.go +++ b/examples/adder/cmd.go @@ -7,8 +7,8 @@ import ( "strings" "time" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" - "gitlab.dms3.io/dms3/public/go-dms3-cmds/cli" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" + "gitlab.dms3.io/dms3/go-dms3-cmds/cli" ) // AddStatus describes the progress of the add operation diff --git a/examples/adder/local/main.go b/examples/adder/local/main.go index e1e8aba..a3c028a 100644 --- a/examples/adder/local/main.go +++ b/examples/adder/local/main.go @@ -5,10 +5,10 @@ import ( "fmt" "os" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" - "gitlab.dms3.io/dms3/public/go-dms3-cmds/examples/adder" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" + "gitlab.dms3.io/dms3/go-dms3-cmds/examples/adder" - "gitlab.dms3.io/dms3/public/go-dms3-cmds/cli" + "gitlab.dms3.io/dms3/go-dms3-cmds/cli" ) func main() { diff --git a/examples/adder/remote/client/main.go b/examples/adder/remote/client/main.go index 2c9179e..4e0c50b 100644 --- a/examples/adder/remote/client/main.go +++ b/examples/adder/remote/client/main.go @@ -4,12 +4,12 @@ import ( "context" "os" - "gitlab.dms3.io/dms3/public/go-dms3-cmds/examples/adder" + "gitlab.dms3.io/dms3/go-dms3-cmds/examples/adder" - //cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" - cli "gitlab.dms3.io/dms3/public/go-dms3-cmds/cli" - http "gitlab.dms3.io/dms3/public/go-dms3-cmds/http" + //cmds "gitlab.dms3.io/dms3/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" + cli "gitlab.dms3.io/dms3/go-dms3-cmds/cli" + http "gitlab.dms3.io/dms3/go-dms3-cmds/http" ) func main() { diff --git a/examples/adder/remote/server/main.go b/examples/adder/remote/server/main.go index 793bca1..9c8c3a5 100644 --- a/examples/adder/remote/server/main.go +++ b/examples/adder/remote/server/main.go @@ -3,9 +3,9 @@ package main import ( nethttp "net/http" - "gitlab.dms3.io/dms3/public/go-dms3-cmds/examples/adder" + "gitlab.dms3.io/dms3/go-dms3-cmds/examples/adder" - http "gitlab.dms3.io/dms3/public/go-dms3-cmds/http" + http "gitlab.dms3.io/dms3/go-dms3-cmds/http" ) type env struct{} diff --git a/go.mod b/go.mod index 8aba9d2..f761caf 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module gitlab.dms3.io/dms3/public/go-dms3-cmds +module gitlab.dms3.io/dms3/go-dms3-cmds go 1.15 @@ -6,7 +6,7 @@ require ( github.com/Kubuxu/go-os-helper v0.0.1 github.com/rs/cors v1.7.0 github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e - gitlab.dms3.io/dms3/public/go-dms3-files v0.0.1 - gitlab.dms3.io/dms3/public/go-log v0.0.1 + gitlab.dms3.io/dms3/go-dms3-files v0.0.2 + gitlab.dms3.io/dms3/go-log v0.0.2 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 ) diff --git a/go.sum b/go.sum index 9fb6d49..694e2cf 100644 --- a/go.sum +++ b/go.sum @@ -26,12 +26,14 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e h1:T5PdfK/M1xyrHwynxMIVMWLS7f/qHwfslZphxtGnw7s= github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e/go.mod h1:XDKHRm5ThF8YJjx001LtgelzsoaEcvnA7lVWz9EeX3g= -gitlab.dms3.io/dms3/public/go-dms3-files v0.0.1 h1:q/ygphIIE5jY55tEWRi4jFFYnQqncEPHA/0yDMfxNGg= -gitlab.dms3.io/dms3/public/go-dms3-files v0.0.1/go.mod h1:6HW2p8o4qGXvZ/TX4A/HzabOPfw3PsxiJbhFxQpqZBM= -gitlab.dms3.io/dms3/public/go-log v0.0.1 h1:jqz2g8pVdPW+Sy8CCo4rYfGEjktGhCBfgIb3oeY6yx8= -gitlab.dms3.io/dms3/public/go-log v0.0.1/go.mod h1:OsyF7lVYe47r03v1ZCbrmz0byeGUWB0Y219jN1DJx3s= +gitlab.dms3.io/dms3/go-dms3-files v0.0.2 h1:M1MrOweEeocg8fyDbndzNLN3NeTiRyWRtIv9F824qQ4= +gitlab.dms3.io/dms3/go-dms3-files v0.0.2/go.mod h1:dOpf6TLZxmWLy5kfMniycGJkWIPTgCcoeaaTNZ9+0To= +gitlab.dms3.io/dms3/go-log v0.0.2 h1:vuNG5qmx6P9iK+A1+k4AmC6Q+ORm2ekWaQVbMmeL2wc= +gitlab.dms3.io/dms3/go-log v0.0.2/go.mod h1:iLuW2zqJJaP1WdbME4P6AS9AIMovwGDAn3zV/riR5iE= go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= @@ -75,5 +77,7 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/http/client.go b/http/client.go index 7b62db3..6641002 100644 --- a/http/client.go +++ b/http/client.go @@ -9,8 +9,8 @@ import ( "net/url" "strings" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" - files "gitlab.dms3.io/dms3/public/go-dms3-files" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" + files "gitlab.dms3.io/dms3/go-dms3-files" ) const ( diff --git a/http/client_test.go b/http/client_test.go index 86f07a6..aacdf65 100644 --- a/http/client_test.go +++ b/http/client_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) func TestClientUserAgent(t *testing.T) { diff --git a/http/config.go b/http/config.go index 644a33b..3c4c4d7 100644 --- a/http/config.go +++ b/http/config.go @@ -114,7 +114,7 @@ func allowOrigin(r *http.Request, cfg *ServerConfig) bool { // the API would be vulnerable to. We check that the Referer // is allowed by CORS Origin (origins and referrers here will // work similarly in the normal uses of the API). -// See discussion at https://gitlab.dms3.io/dms3/public/go-dms3/issues/1532 +// See discussion at https://gitlab.dms3.io/dms3/go-dms3/issues/1532 func allowReferer(r *http.Request, cfg *ServerConfig) bool { referer := r.Referer() diff --git a/http/errors_test.go b/http/errors_test.go index 1f0e735..5c53a29 100644 --- a/http/errors_test.go +++ b/http/errors_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) func TestErrors(t *testing.T) { diff --git a/http/flushfwd.go b/http/flushfwd.go index 6f99849..0d73bd9 100644 --- a/http/flushfwd.go +++ b/http/flushfwd.go @@ -3,7 +3,7 @@ package http import ( "net/http" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) type flushfwder struct { diff --git a/http/handler.go b/http/handler.go index 0688904..054f7ec 100644 --- a/http/handler.go +++ b/http/handler.go @@ -10,8 +10,8 @@ import ( "time" cors "github.com/rs/cors" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" - logging "gitlab.dms3.io/dms3/public/go-log" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" + logging "gitlab.dms3.io/dms3/go-log" ) var log = logging.Logger("cmds/http") @@ -132,7 +132,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { // If we have a request body, make sure the preamble // knows that it should close the body if it wants to // write before completing reading. - // FIXME: https://gitlab.dms3.io/dms3/public/go-dms3/issues/5168 + // FIXME: https://gitlab.dms3.io/dms3/go-dms3/issues/5168 // FIXME: https://github.com/golang/go/issues/15527 var bodyEOFChan chan struct{} if r.Body != http.NoBody { diff --git a/http/handler_test.go b/http/handler_test.go index c2ab3a7..d8467bd 100644 --- a/http/handler_test.go +++ b/http/handler_test.go @@ -11,8 +11,8 @@ import ( "testing" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" - files "gitlab.dms3.io/dms3/public/go-dms3-files" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" + files "gitlab.dms3.io/dms3/go-dms3-files" ) type VersionOutput struct { diff --git a/http/http_test.go b/http/http_test.go index d10f7e8..636ef30 100644 --- a/http/http_test.go +++ b/http/http_test.go @@ -12,9 +12,9 @@ import ( "strings" "testing" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" - files "gitlab.dms3.io/dms3/public/go-dms3-files" + files "gitlab.dms3.io/dms3/go-dms3-files" ) func newReaderPathFile(t *testing.T, path string, reader io.ReadCloser, stat os.FileInfo) files.File { diff --git a/http/parse.go b/http/parse.go index c0f2617..b8c7dbe 100644 --- a/http/parse.go +++ b/http/parse.go @@ -10,10 +10,10 @@ import ( "strconv" "strings" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" - files "gitlab.dms3.io/dms3/public/go-dms3-files" - logging "gitlab.dms3.io/dms3/public/go-log" + files "gitlab.dms3.io/dms3/go-dms3-files" + logging "gitlab.dms3.io/dms3/go-log" ) // parseRequest parses the data in a http.Request and returns a command Request object diff --git a/http/parse_test.go b/http/parse_test.go index 27e9eee..eb11681 100644 --- a/http/parse_test.go +++ b/http/parse_test.go @@ -9,7 +9,7 @@ import ( "reflect" "testing" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) func TestParse(t *testing.T) { diff --git a/http/reforigin_test.go b/http/reforigin_test.go index 3147694..2f74ae8 100644 --- a/http/reforigin_test.go +++ b/http/reforigin_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) func assertHeaders(t *testing.T, resHeaders http.Header, reqHeaders map[string]string) { diff --git a/http/response.go b/http/response.go index ec9b86d..0bb48b1 100644 --- a/http/response.go +++ b/http/response.go @@ -7,7 +7,7 @@ import ( "reflect" "strings" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) var ( diff --git a/http/response_test.go b/http/response_test.go index 48e0cdd..66e0edd 100644 --- a/http/response_test.go +++ b/http/response_test.go @@ -3,7 +3,7 @@ package http import ( "testing" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) type testResponseType struct { diff --git a/http/responseemitter.go b/http/responseemitter.go index d45c70f..3c6e9e4 100644 --- a/http/responseemitter.go +++ b/http/responseemitter.go @@ -8,7 +8,7 @@ import ( "strings" "sync" - cmds "gitlab.dms3.io/dms3/public/go-dms3-cmds" + cmds "gitlab.dms3.io/dms3/go-dms3-cmds" ) var ( @@ -269,7 +269,7 @@ func (re *responseEmitter) doPreamble(value interface{}) { // If we have a request body, make sure we close the body // if we want to write before completing reading. - // FIXME: https://gitlab.dms3.io/dms3/public/go-dms3/issues/5168 + // FIXME: https://gitlab.dms3.io/dms3/go-dms3/issues/5168 // FIXME: https://github.com/golang/go/issues/15527 if re.bodyEOFChan != nil { select { diff --git a/request.go b/request.go index 01bd954..2588b3b 100644 --- a/request.go +++ b/request.go @@ -5,7 +5,7 @@ import ( "fmt" "reflect" - files "gitlab.dms3.io/dms3/public/go-dms3-files" + files "gitlab.dms3.io/dms3/go-dms3-files" ) // Request represents a call to a command from a consumer -- GitLab