diff options
author | Alan Pearce | 2024-04-18 17:37:07 +0200 |
---|---|---|
committer | Alan Pearce | 2024-04-18 19:09:50 +0200 |
commit | 88e5a55c838a28c36573ad523e4bcf3ff51355f8 (patch) | |
tree | e169aa7877e75b7a500361ae6653bdabea9b7da7 /cmd/build/build.go | |
parent | 6b2d980df841068bca3fe88f2e39091858491edf (diff) | |
download | website-88e5a55c838a28c36573ad523e4bcf3ff51355f8.tar.lz website-88e5a55c838a28c36573ad523e4bcf3ff51355f8.tar.zst website-88e5a55c838a28c36573ad523e4bcf3ff51355f8.zip |
copy static files directly in go
Diffstat (limited to 'cmd/build/build.go')
-rw-r--r-- | cmd/build/build.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cmd/build/build.go b/cmd/build/build.go index 4254bf8..5007ead 100644 --- a/cmd/build/build.go +++ b/cmd/build/build.go @@ -26,6 +26,7 @@ import ( "github.com/antchfx/xmlquery" "github.com/antchfx/xpath" mapset "github.com/deckarep/golang-set/v2" + cp "github.com/otiai10/copy" "github.com/pkg/errors" "github.com/yuin/goldmark" "github.com/yuin/goldmark/extension" @@ -529,6 +530,15 @@ func main() { log.Panic(errors.Errorf("working directory does not exist: %v", err)) } + err = os.RemoveAll("public") + if err != nil { + log.Panic(errors.Errorf("could not remove public directory: %v", err)) + } + err = cp.Copy("static", "public", cp.Options{}) + if err != nil { + log.Panic(errors.Errorf("could not copy static files: %v", err)) + } + if err := build(); err != nil { switch cause := errors.Cause(err).(type) { case *fs.PathError: |