diff --git a/Dockerfile b/Dockerfile index d858532..fa66086 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the application -FROM golang:1.15-alpine AS build +FROM golang:1.16-alpine AS build RUN apk update && apk upgrade && \ apk add --no-cache bash git openssh build-base WORKDIR /app @@ -9,7 +9,7 @@ COPY . . RUN go build \ -o pasty \ -ldflags "\ - -X github.com/Lukaesebrot/pasty/internal/static.Version=$(git rev-parse --abbrev-ref HEAD)-$(git describe --tags --abbrev=0)-$(git log --pretty=format:'%h' -n 1)" \ + -X github.com/lus/pasty/internal/static.Version=$(git rev-parse --abbrev-ref HEAD)-$(git describe --tags --abbrev=0)-$(git log --pretty=format:'%h' -n 1)" \ ./cmd/pasty/main.go # Run the application in an empty alpine environment diff --git a/cmd/pasty/main.go b/cmd/pasty/main.go index ac9f1a2..ca59a2a 100644 --- a/cmd/pasty/main.go +++ b/cmd/pasty/main.go @@ -1,11 +1,12 @@ package main import ( - "github.com/Lukaesebrot/pasty/internal/env" - "github.com/Lukaesebrot/pasty/internal/storage" - "github.com/Lukaesebrot/pasty/internal/web" "log" "time" + + "github.com/lus/pasty/internal/env" + "github.com/lus/pasty/internal/storage" + "github.com/lus/pasty/internal/web" ) func main() { diff --git a/cmd/transfer/main.go b/cmd/transfer/main.go index 9ee6521..ce7b39a 100644 --- a/cmd/transfer/main.go +++ b/cmd/transfer/main.go @@ -1,10 +1,11 @@ package main import ( - "github.com/Lukaesebrot/pasty/internal/env" - "github.com/Lukaesebrot/pasty/internal/storage" "log" "os" + + "github.com/lus/pasty/internal/env" + "github.com/lus/pasty/internal/storage" ) func main() { diff --git a/go.mod b/go.mod index 5378902..ce9646b 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ -module github.com/Lukaesebrot/pasty +module github.com/lus/pasty -go 1.15 +go 1.16 require ( github.com/alexedwards/argon2id v0.0.0-20200802152012-2464efd3196b diff --git a/go.sum b/go.sum index 1ae1ead..72ebfa0 100644 --- a/go.sum +++ b/go.sum @@ -76,7 +76,6 @@ github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0Lh github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.9.6/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.10.7 h1:7rix8v8GpI3ZBb0nSozFRgbtXKv+hOe+qfEpZqybrAg= github.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.10.11 h1:K9z59aO18Aywg2b/WSgBaUX99mHy2BES18Cr5lBKZHk= github.com/klauspost/compress v1.10.11/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= @@ -86,10 +85,8 @@ github.com/klauspost/cpuid v1.3.1 h1:5JNjFYYQrZeKRJ0734q51WCEEn2huer72Dc7K+R/b6s github.com/klauspost/cpuid v1.3.1/go.mod h1:bYW4mA6ZgKPob1/Dlai2LviZJO7KGI3uoWLd42rAQw4= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/lib/pq v1.8.0 h1:9xohqzkUwzR4Ga4ivdTcawVS89YSDVxXMa3xJX3cGzg= @@ -170,7 +167,6 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200414173820-0848c9571904 h1:bXoxMPcSLOq08zI3/c5dEBT6lE4eh+jOh886GHrn6V8= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 h1:DZhuSZLsGlFL4CmhA8BcRA0mnthyA/nZ00AqCUo7vHg= @@ -203,7 +199,6 @@ golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y= golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -219,7 +214,6 @@ golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= diff --git a/internal/env/env.go b/internal/env/env.go index 60837c0..c03f8bd 100644 --- a/internal/env/env.go +++ b/internal/env/env.go @@ -1,11 +1,12 @@ package env import ( - "github.com/Lukaesebrot/pasty/internal/static" - "github.com/joho/godotenv" "os" "strconv" "time" + + "github.com/joho/godotenv" + "github.com/lus/pasty/internal/static" ) // Load loads an optional .env file diff --git a/internal/pastes/deletion_token.go b/internal/pastes/deletion_token.go index a22a7cb..d34e3c3 100644 --- a/internal/pastes/deletion_token.go +++ b/internal/pastes/deletion_token.go @@ -1,9 +1,10 @@ package pastes import ( - "github.com/Lukaesebrot/pasty/internal/env" - "github.com/Lukaesebrot/pasty/internal/utils" "strconv" + + "github.com/lus/pasty/internal/env" + "github.com/lus/pasty/internal/utils" ) // generateDeletionToken generates a new deletion token diff --git a/internal/pastes/paste.go b/internal/pastes/paste.go index 4b3a08a..f5e3129 100644 --- a/internal/pastes/paste.go +++ b/internal/pastes/paste.go @@ -1,9 +1,10 @@ package pastes import ( - "github.com/Lukaesebrot/pasty/internal/env" - "github.com/alexedwards/argon2id" "time" + + "github.com/alexedwards/argon2id" + "github.com/lus/pasty/internal/env" ) // Paste represents a saved paste diff --git a/internal/storage/driver.go b/internal/storage/driver.go index a5ab35c..26117fc 100644 --- a/internal/storage/driver.go +++ b/internal/storage/driver.go @@ -2,9 +2,10 @@ package storage import ( "fmt" - "github.com/Lukaesebrot/pasty/internal/env" - "github.com/Lukaesebrot/pasty/internal/pastes" "strings" + + "github.com/lus/pasty/internal/env" + "github.com/lus/pasty/internal/pastes" ) // Current holds the current storage driver diff --git a/internal/storage/file_driver.go b/internal/storage/file_driver.go index ca32486..bd00742 100644 --- a/internal/storage/file_driver.go +++ b/internal/storage/file_driver.go @@ -3,13 +3,14 @@ package storage import ( "encoding/base64" "encoding/json" - "github.com/Lukaesebrot/pasty/internal/env" - "github.com/Lukaesebrot/pasty/internal/pastes" "io/ioutil" "os" "path/filepath" "strings" "time" + + "github.com/lus/pasty/internal/env" + "github.com/lus/pasty/internal/pastes" ) // FileDriver represents the file storage driver diff --git a/internal/storage/id_generation.go b/internal/storage/id_generation.go index 9e2571d..72f61d7 100644 --- a/internal/storage/id_generation.go +++ b/internal/storage/id_generation.go @@ -1,9 +1,10 @@ package storage import ( - "github.com/Lukaesebrot/pasty/internal/env" - "github.com/Lukaesebrot/pasty/internal/utils" "strconv" + + "github.com/lus/pasty/internal/env" + "github.com/lus/pasty/internal/utils" ) // AcquireID generates a new unique ID diff --git a/internal/storage/mongodb_driver.go b/internal/storage/mongodb_driver.go index cb4c225..66c90d1 100644 --- a/internal/storage/mongodb_driver.go +++ b/internal/storage/mongodb_driver.go @@ -2,13 +2,14 @@ package storage import ( "context" - "github.com/Lukaesebrot/pasty/internal/env" - "github.com/Lukaesebrot/pasty/internal/pastes" + "time" + + "github.com/lus/pasty/internal/env" + "github.com/lus/pasty/internal/pastes" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/readpref" - "time" ) // MongoDBDriver represents the MongoDB storage driver diff --git a/internal/storage/s3_driver.go b/internal/storage/s3_driver.go index b0a82f8..3c95ad1 100644 --- a/internal/storage/s3_driver.go +++ b/internal/storage/s3_driver.go @@ -4,13 +4,14 @@ import ( "bytes" "context" "encoding/json" - "github.com/Lukaesebrot/pasty/internal/env" - "github.com/Lukaesebrot/pasty/internal/pastes" - "github.com/minio/minio-go/v7" - "github.com/minio/minio-go/v7/pkg/credentials" "io/ioutil" "strings" "time" + + "github.com/lus/pasty/internal/env" + "github.com/lus/pasty/internal/pastes" + "github.com/minio/minio-go/v7" + "github.com/minio/minio-go/v7/pkg/credentials" ) // S3Driver represents the AWS S3 storage driver diff --git a/internal/storage/sql_driver.go b/internal/storage/sql_driver.go index ba3965d..87e816d 100644 --- a/internal/storage/sql_driver.go +++ b/internal/storage/sql_driver.go @@ -2,12 +2,13 @@ package storage import ( "database/sql" - "github.com/Lukaesebrot/pasty/internal/env" - "github.com/Lukaesebrot/pasty/internal/pastes" + "time" + _ "github.com/go-sql-driver/mysql" _ "github.com/lib/pq" + "github.com/lus/pasty/internal/env" + "github.com/lus/pasty/internal/pastes" _ "github.com/mattn/go-sqlite3" - "time" ) // SQLDriver represents the SQL storage driver diff --git a/internal/web/controllers/v1/hastebin_support.go b/internal/web/controllers/v1/hastebin_support.go index b801a2b..1b00acd 100644 --- a/internal/web/controllers/v1/hastebin_support.go +++ b/internal/web/controllers/v1/hastebin_support.go @@ -2,8 +2,9 @@ package v1 import ( "encoding/json" - "github.com/Lukaesebrot/pasty/internal/pastes" - "github.com/Lukaesebrot/pasty/internal/storage" + + "github.com/lus/pasty/internal/pastes" + "github.com/lus/pasty/internal/storage" "github.com/valyala/fasthttp" ) diff --git a/internal/web/controllers/v1/pastes.go b/internal/web/controllers/v1/pastes.go index ed25f10..b463040 100644 --- a/internal/web/controllers/v1/pastes.go +++ b/internal/web/controllers/v1/pastes.go @@ -2,9 +2,10 @@ package v1 import ( "encoding/json" - "github.com/Lukaesebrot/pasty/internal/pastes" - "github.com/Lukaesebrot/pasty/internal/storage" + "github.com/fasthttp/router" + "github.com/lus/pasty/internal/pastes" + "github.com/lus/pasty/internal/storage" limitFasthttp "github.com/ulule/limiter/v3/drivers/middleware/fasthttp" "github.com/valyala/fasthttp" ) diff --git a/internal/web/web.go b/internal/web/web.go index dd952a0..b8028ea 100644 --- a/internal/web/web.go +++ b/internal/web/web.go @@ -2,16 +2,17 @@ package web import ( "encoding/json" - "github.com/Lukaesebrot/pasty/internal/env" - "github.com/Lukaesebrot/pasty/internal/static" - v1 "github.com/Lukaesebrot/pasty/internal/web/controllers/v1" + "path/filepath" + "strings" + routing "github.com/fasthttp/router" + "github.com/lus/pasty/internal/env" + "github.com/lus/pasty/internal/static" + v1 "github.com/lus/pasty/internal/web/controllers/v1" "github.com/ulule/limiter/v3" limitFasthttp "github.com/ulule/limiter/v3/drivers/middleware/fasthttp" "github.com/ulule/limiter/v3/drivers/store/memory" "github.com/valyala/fasthttp" - "path/filepath" - "strings" ) // Serve serves the web resources