Skip to content

Commit

Permalink
Do the go v3 'properly' (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
freeformz authored Mar 4, 2024
1 parent ee08908 commit 8371987
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 36 deletions.
43 changes: 21 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
build:
go get github.com/mat/besticon/...

go build ./...
test_all: build test test_bench
go test -v github.com/mat/besticon/besticon/iconserver

test:
go test -v github.com/mat/besticon/ico
go test -v github.com/mat/besticon/besticon
go test -v github.com/mat/besticon/besticon/iconserver
go test -v github.com/mat/besticon/lettericon
go test -v github.com/mat/besticon/colorfinder
go test -v github.com/mat/besticon/v3/ico
go test -v github.com/mat/besticon/v3/besticon
go test -v github.com/mat/besticon/v3/besticon/iconserver
go test -v github.com/mat/besticon/v3/lettericon
go test -v github.com/mat/besticon/v3/colorfinder

test_race:
go test -v -race github.com/mat/besticon/ico
go test -v -race github.com/mat/besticon/besticon
go test -v -race github.com/mat/besticon/besticon/iconserver
go test -v -race github.com/mat/besticon/lettericon
go test -v -race github.com/mat/besticon/colorfinder
go test -v -race github.com/mat/besticon/v3/ico
go test -v -race github.com/mat/besticon/v3/besticon
go test -v -race github.com/mat/besticon/v3/besticon/iconserver
go test -v -race github.com/mat/besticon/v3/lettericon
go test -v -race github.com/mat/besticon/v3/colorfinder

test_bench:
go test github.com/mat/besticon/lettericon -bench .
go test github.com/mat/besticon/colorfinder -bench .
go test github.com/mat/besticon/v3/lettericon -bench .
go test github.com/mat/besticon/v3/colorfinder -bench .

deploy:
git push heroku master
Expand All @@ -30,17 +29,17 @@ install:
go get ./...

run_server:
go build -o bin/iconserver github.com/mat/besticon/besticon/iconserver
go build -o bin/iconserver github.com/mat/besticon/v3/besticon/iconserver
PORT=3000 DEPLOYED_AT=`date +%s` HOST_ONLY_DOMAINS=* POPULAR_SITES=bing.com,github.com,instagram.com,reddit.com ./bin/iconserver

coverage_besticon:
go test -coverprofile=coverage.out -covermode=count github.com/mat/besticon/besticon && go tool cover -html=coverage.out && unlink coverage.out
go test -coverprofile=coverage.out -covermode=count github.com/mat/besticon/v3/besticon && go tool cover -html=coverage.out && unlink coverage.out

coverage_ico:
go test -coverprofile=coverage.out -covermode=count github.com/mat/besticon/ico && go tool cover -html=coverage.out && unlink coverage.out
go test -coverprofile=coverage.out -covermode=count github.com/mat/besticon/v3/ico && go tool cover -html=coverage.out && unlink coverage.out

coverage_iconserver:
go test -coverprofile=coverage.out -covermode=count github.com/mat/besticon/besticon/iconserver && go tool cover -html=coverage.out && unlink coverage.out
go test -coverprofile=coverage.out -covermode=count github.com/mat/besticon/v3/besticon/iconserver && go tool cover -html=coverage.out && unlink coverage.out

test_websites:
go get ./...
Expand All @@ -61,16 +60,16 @@ clean:
rm -f iconserver*.zip

build_darwin_amd64:
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -o bin/darwin_amd64/iconserver -ldflags "-X github.com/mat/besticon/besticon.BuildDate=`date +'%Y-%m-%d'`" github.com/mat/besticon/besticon/iconserver
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -o bin/darwin_amd64/iconserver -ldflags "-X github.com/mat/besticon/v3/besticon.BuildDate=`date +'%Y-%m-%d'`" github.com/mat/besticon/besticon/iconserver

build_linux_amd64:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -o bin/linux_amd64/iconserver -ldflags "-X github.com/mat/besticon/besticon.BuildDate=`date +'%Y-%m-%d'`" github.com/mat/besticon/besticon/iconserver
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -o bin/linux_amd64/iconserver -ldflags "-X github.com/mat/besticon/v3/besticon.BuildDate=`date +'%Y-%m-%d'`" github.com/mat/besticon/besticon/iconserver

build_linux_arm64:
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -installsuffix cgo -o bin/linux_arm64/iconserver -ldflags "-X github.com/mat/besticon/besticon.BuildDate=`date +'%Y-%m-%d'`" github.com/mat/besticon/besticon/iconserver
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -installsuffix cgo -o bin/linux_arm64/iconserver -ldflags "-X github.com/mat/besticon/v3/besticon.BuildDate=`date +'%Y-%m-%d'`" github.com/mat/besticon/besticon/iconserver

build_windows_amd64:
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -o bin/windows_amd64/iconserver.exe -ldflags "-X github.com/mat/besticon/besticon.BuildDate=`date +'%Y-%m-%d'`" github.com/mat/besticon/besticon/iconserver
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -o bin/windows_amd64/iconserver.exe -ldflags "-X github.com/mat/besticon/v3/besticon.BuildDate=`date +'%Y-%m-%d'`" github.com/mat/besticon/besticon/iconserver

build_all_platforms: build_darwin_amd64 build_linux_amd64 build_linux_arm64 build_windows_amd64
find bin/ -type file | xargs file
Expand Down
4 changes: 2 additions & 2 deletions besticon/besticon.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
_ "image/jpeg"
_ "image/png"

_ "github.com/mat/besticon/ico"
_ "github.com/mat/besticon/v3/ico"

"github.com/mat/besticon/colorfinder"
"github.com/mat/besticon/v3/colorfinder"

"golang.org/x/net/html/charset"
)
Expand Down
2 changes: 1 addition & 1 deletion besticon/besticon/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"io/ioutil"
"os"

"github.com/mat/besticon/besticon"
"github.com/mat/besticon/v3/besticon"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion besticon/besticon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"reflect"
"testing"

"github.com/mat/besticon/vcr"
"github.com/mat/besticon/v3/vcr"
)

//
Expand Down
6 changes: 3 additions & 3 deletions besticon/iconserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
"strings"
"time"

"github.com/mat/besticon/besticon"
"github.com/mat/besticon/besticon/iconserver/assets"
"github.com/mat/besticon/lettericon"
"github.com/mat/besticon/v3/besticon"
"github.com/mat/besticon/v3/besticon/iconserver/assets"
"github.com/mat/besticon/v3/lettericon"

"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/rs/cors"
Expand Down
2 changes: 1 addition & 1 deletion besticon/iconserver/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"testing"
"time"

"github.com/mat/besticon/besticon"
"github.com/mat/besticon/v3/besticon"
)

func TestGetIndex(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion colorfinder/colorfinder.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
_ "image/jpeg"
_ "image/png"

_ "github.com/mat/besticon/ico"
_ "github.com/mat/besticon/v3/ico"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/mat/besticon
module github.com/mat/besticon/v3

// +heroku goVersion go1.21

Expand Down
2 changes: 1 addition & 1 deletion ico/icoparser/icoparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"os"

"github.com/mat/besticon/ico"
"github.com/mat/besticon/v3/ico"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions lettericon/lettericon.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"golang.org/x/net/publicsuffix"

"github.com/golang/freetype/truetype"
"github.com/mat/besticon/colorfinder"
"github.com/mat/besticon/lettericon/fonts"
"github.com/mat/besticon/v3/colorfinder"
"github.com/mat/besticon/v3/lettericon/fonts"
)

const dpi = 72
Expand Down
2 changes: 1 addition & 1 deletion lettericon/lettericon/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"log"
"os"

"github.com/mat/besticon/lettericon"
"github.com/mat/besticon/v3/lettericon"
)

var (
Expand Down

0 comments on commit 8371987

Please sign in to comment.