Skip to content

Commit

Permalink
Merge pull request #245 from c-bata/remove-statik
Browse files Browse the repository at this point in the history
Remove `statik` dependency
  • Loading branch information
c-bata authored Sep 8, 2023
2 parents f0316e7 + d5e42e1 commit 1752dd1
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 133 deletions.
1 change: 0 additions & 1 deletion .github/workflows/go-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ jobs:
./bin/sobol
./bin/cmaes_blackhole
./bin/simple_tpe
./bin/concurrency
./bin/trialnotify
9 changes: 1 addition & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GODOC ?= godoc

.DEFAULT_GOAL := help

SOURCES := $(shell find . -name "*.go" | grep -v -e "sobol/direction_numbers.go" -e "dashboard/statik/statik.go")
SOURCES := $(shell find . -name "*.go" | grep -v -e "sobol/direction_numbers.go")

.PHONY: fmt
fmt: $(SOURCES) ## Formatting source codes.
Expand Down Expand Up @@ -49,13 +49,6 @@ build: ## Build example command lines.
$(GO) build -o ./bin/goptuna -ldflags "$(LDFLAGS)" cmd/main.go
./_examples/build.sh

.PHONY: build-dashboard
build-dashboard: ## Build dashboard and bundle it.
docker build -t c-bata/goptuna-dashboard ./dashboard
docker run -it --rm \
-v `PWD`/dashboard/statik:/usr/src/statik \
c-bata/goptuna-dashboard

.PHONY: help
help: ## Show help text
@echo "Commands:"
Expand Down
4 changes: 2 additions & 2 deletions _examples/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ set -ex

go build -o ${BIN_DIR}/cmaes ${DIR}/cmaes/main.go
go build -o ${BIN_DIR}/cmaes_blackhole ${DIR}/cmaes/blackhole/main.go
go build -o ${BIN_DIR}/concurrency ${DIR}/concurrency/main.go
go build -o ${BIN_DIR}/enqueue_trial ${DIR}/enqueue_trial/main.go
go build -o ${BIN_DIR}/trialnotify ${DIR}/trialnotify/main.go
go build -o ${BIN_DIR}/signalhandling ${DIR}/signalhandling/main.go
go build -o ${BIN_DIR}/simple_rdb ${DIR}/simple_rdb/main.go
go build -o ${BIN_DIR}/simple_tpe ${DIR}/simple_tpe/main.go
go build -o ${BIN_DIR}/sobol ${DIR}/sobol/main.go
go build -o ${BIN_DIR}/gorgonia_iris ${DIR}/gorgonia_iris/main.go
#go build -o ${BIN_DIR}/concurrency ${DIR}/concurrency/main.go
#go build -o ${BIN_DIR}/gorgonia_iris ${DIR}/gorgonia_iris/main.go
1 change: 0 additions & 1 deletion dashboard/.node-version

This file was deleted.

26 changes: 0 additions & 26 deletions dashboard/Dockerfile

This file was deleted.

25 changes: 2 additions & 23 deletions dashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

## Running dashboard

Pre-built JavaScript files are embedded using:

* `go:embed` for Go1.16 or later.
* [rakyll/statik](https://github.com/rakyll/statik) for Go1.15 or older.

Pre-built JavaScript files are embedded using `go:embed`.
So it's ok you just run `goptuna dashboard` command like this:

```
Expand Down Expand Up @@ -43,19 +39,9 @@ Use "goptuna [command] --help" for more information about a command.

## How to compile TypeScript files

### Compiling TypeScript files and embedding to Go using Docker

You just run to `make build-dashboard` to compile TypeScript files and embedding to Go.

```
$ docker build -t c-bata/goptuna-dashboard ./dashboard
$ docker run -it --rm -v `PWD`/dashboard/statik:/usr/src/statik c-bata/goptuna-dashboard
```


### Compiling TypeScript files manually

Node.js v14.14.0 is required to compile TypeScript files.
Node.js v20 is required to compile TypeScript files.

```
$ npm install
Expand All @@ -80,13 +66,6 @@ $ npm run build:prd

</details>

### Embeddeing to Go using rakyll/statik

```
$ statik -src=./public -include=bundle.js,bundle.js.LICENSE.txt
```


## Running Dashboard server for reloading

Please pass `-tags=develop` the custom build tag to return JS files inside local directory (not embedded files).
Expand Down
2 changes: 1 addition & 1 deletion dashboard/staticfiles_embed.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !develop && go1.16
//go:build !develop

package dashboard

Expand Down
54 changes: 0 additions & 54 deletions dashboard/staticfiles_statik.go

This file was deleted.

14 changes: 0 additions & 14 deletions dashboard/statik/statik.go

This file was deleted.

1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require (
github.com/google/uuid v1.3.1
github.com/gorilla/mux v1.8.0
github.com/jinzhu/gorm v1.9.16
github.com/rakyll/statik v0.1.7
github.com/spf13/cobra v1.7.0
gonum.org/v1/gonum v0.14.0
gorm.io/driver/mysql v1.0.3
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ=
github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
Expand Down

0 comments on commit 1752dd1

Please sign in to comment.