Skip to content

Commit

Permalink
Remove elazarl/go-bindata-assetfs in favor of the built-in embed (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
joschi authored Sep 6, 2024
1 parent e9640eb commit 230b671
Show file tree
Hide file tree
Showing 12 changed files with 7 additions and 430 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.18

require (
github.com/basgys/goxml2json v1.1.0
github.com/elazarl/go-bindata-assetfs v1.0.0
github.com/fatih/color v1.16.0
github.com/ghodss/yaml v1.0.0
github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ github.com/bitly/go-simplejson v0.5.1/go.mod h1:YOPVLzCfwK14b4Sff3oP1AmGhI9T9Vsg
github.com/corpix/uarand v0.2.0 h1:U98xXwud/AVuCpkpgfPF7J5TQgr7R5tqT8VZP5KWbzE=
github.com/corpix/uarand v0.2.0/go.mod h1:/3Z1QIqWkDIhf6XWn/08/uMHoQ8JUoTIKc2iPchBOmM=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk=
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
Expand Down
419 changes: 0 additions & 419 deletions internal/console/bindata.go

This file was deleted.

7 changes: 5 additions & 2 deletions internal/console/dispatcher.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package console

import (
"embed"
"errors"
"fmt"
assetfs "github.com/elazarl/go-bindata-assetfs"
"github.com/jmartin82/mmock/v3/internal/config"
"github.com/jmartin82/mmock/v3/internal/config/logger"
"github.com/jmartin82/mmock/v3/internal/statistics"
Expand All @@ -17,6 +17,9 @@ import (
"strings"
)

//go:embed tmpl
var assetFS embed.FS

var log = logger.Log

var pagePattern = regexp.MustCompile(`^[1-9]([0-9]+)?$`)
Expand Down Expand Up @@ -73,7 +76,7 @@ func (di *Dispatcher) Start() {
e.GET("/echo", di.webSocketHandler)

//HTTP
statics := http.FileServer(&assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo, Prefix: "tmpl"})
statics := http.FileServer(http.FS(assetFS))
e.GET("/js/*", echo.WrapHandler(statics))
e.GET("/css/*", echo.WrapHandler(statics))
e.GET("/swagger.json", di.swaggerHandler)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 2 additions & 6 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: build doc fmt lint dev test vet bindata
.PHONY: build doc fmt lint dev test vet

PKG_NAME=mmock
NS = jordimartin
Expand All @@ -7,14 +7,10 @@ VERSION ?= latest
export GO111MODULE=on


build: bindata \
vet \
build: vet \
test
go build -v -o ./bin/$(PKG_NAME) cmd/mmock/main.go

bindata:
go-bindata -pkg console -o internal/console/bindata.go tmpl/*

doc:
godoc -http=:6060

Expand Down

0 comments on commit 230b671

Please sign in to comment.