Skip to content

Commit

Permalink
Fix gofmt compability
Browse files Browse the repository at this point in the history
Resolves: #106
  • Loading branch information
Jonas Falck committed Feb 27, 2020
1 parent 46bd79c commit c98fefe
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ install:

script:
- go test -v -bench=. ./...
- test -z $(gofmt -l ./example/statik/statik.go | tee /dev/stderr) || (echo 'Code not formatted correctly according to gofmt!' && exit 1)

9 changes: 4 additions & 5 deletions example/statik/statik.go

Large diffs are not rendered by default.

19 changes: 8 additions & 11 deletions statik.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,25 +282,22 @@ import (
`, tags, comment, namePackage)
if !fs.IsDefaultNamespace(assetNamespace) {
fmt.Fprintf(&qb, `
const %s = "%s" // static asset namespace
fmt.Fprintf(&qb, `const %s = "%s" // static asset namespace
`, assetNamespaceIdentify, assetNamespace)
}
fmt.Fprint(&qb, `
func init() {
fmt.Fprint(&qb, `func init() {
data := "`)
FprintZipData(&qb, buffer.Bytes())
if fs.IsDefaultNamespace(assetNamespace) {
fmt.Fprint(&qb, `"
fs.Register(data)
}
`)

fs.Register(data)
}
`)
} else {
fmt.Fprintf(&qb, `"
fs.RegisterWithNamespace("%s", data)
}
`, assetNamespace)
fs.RegisterWithNamespace("%s", data)
}
`, assetNamespace)
}

if err = ioutil.WriteFile(f.Name(), qb.Bytes(), 0644); err != nil {
Expand Down

0 comments on commit c98fefe

Please sign in to comment.