Code Monkey home page Code Monkey logo

Comments (7)

aprice avatar aprice commented on May 24, 2024

Using master@HEAD I'm not able to reproduce the issue - make sure you're using the latest version of the embed binary and the latest version of the embed/loader library within your project.

from embed.

andig avatar andig commented on May 24, 2024

Thanks for the quick reply. My testing steps are as follows (go 1.11):

  • Update go.mod with the respective aprice/embed commit hash
  • Generate the assets go generate which triggers fetching the library commit
  • Run application go run cmd/server/main.go and test using curl

This is the embedding comment:

//go:generate go run github.com/aprice/embed/cmd/embed -c "embed.json"

That sequence should update both embed and loader?

from embed.

aprice avatar aprice commented on May 24, 2024

That only updates the loader library. To update the embed binary you'd need to run go get -u github.com/aprice/embed/cmd/embed. Your go run command will build & run whatever you have locally, it won't update it.

from embed.

andig avatar andig commented on May 24, 2024

Still no help:

❯ go get -u github.com/aprice/embed/cmd/embed
go: finding github.com/aprice/embed/cmd/embed latest
go: finding github.com/aprice/embed/cmd latest
go: finding github.com/aprice/embed latest

❯ go get -u github.com/aprice/embed

Then either

❯ go generate
Embedded  /css/app.css
Embedded  /css/bootstrap.min.css
Embedded  /index.tmpl
Embedded  /js/app.js
Embedded  /js/bootstrap.min.js
Embedded  /js/jquery-3.2.1.min.js
Embedded  /js/tether.min.js
Embedded  /js/vue.min.js
Embedded  /simple.tmpl
Generation complete in 195.487122ms

or

❯ go run github.com/aprice/embed/cmd/embed -c "embed.json"
Embedded  /css/app.css
Embedded  /css/bootstrap.min.css
Embedded  /index.tmpl
Embedded  /js/app.js
Embedded  /js/bootstrap.min.js
Embedded  /js/jquery-3.2.1.min.js
Embedded  /js/tether.min.js
Embedded  /js/vue.min.js
Embedded  /simple.tmpl
Generation complete in 194.430245ms

All give the same result. When I go back to the commit above problem goes away.

from embed.

andig avatar andig commented on May 24, 2024

Problem still exists. Updating the cmd and the package does not help:

~/htdocs/gosdm fix-tests* 12s
❯ rm $GOPATH/bin/embed

~/htdocs/gosdm fix-tests*
❯ go get -u github.com/aprice/embed/cmd/embed
go: finding github.com/aprice/embed/cmd/embed latest
go: finding github.com/aprice/embed/cmd latest
go: finding github.com/aprice/embed latest

~/htdocs/gosdm fix-tests*
❯ ls $GOPATH/bin
embed

~/htdocs/gosdm fix-tests*
❯ go generate
Embedded  /css/app.css
Embedded  /css/bootstrap.min.css
Embedded  /index.html
Embedded  /js/app.js
Embedded  /js/bootstrap.min.js
Embedded  /js/d3-format.min.js
Embedded  /js/jquery-3.2.1.min.js
Embedded  /js/tether.min.js
Embedded  /js/vue.min.js
Generation complete in 514.119666ms

go.mod shows that its the latest commit, too:

github.com/aprice/embed v0.0.0-20171223211210-8e25a549692e

When I update go.mod to an earlier commit the problem is gone.

from embed.

andig avatar andig commented on May 24, 2024

@aprice I'm still (or again) seeing this when updating to a current version. For me it is breaking when updating my go.mod like this:

-	github.com/aprice/embed v0.0.0-20171223211210-e0f543275bf966271e2c3b3ab70265f635f0394a
+	github.com/aprice/embed v0.0.0-20181126214606-b9ceb1f6d22d

Verified checking curl output for the asset:

curl -sH 'Accept-encoding: gzip' localhost:8080/js/app.js | gunzip - 

Problem only exists with gzip, not with plain request. Happens for CSS and JS but funny enough not for the root html:

// static
router.HandleFunc("/", MkIndexHandler(mc))
router.PathPrefix("/js/").Handler(GetEmbeddedContent())
router.PathPrefix("/css/").Handler(GetEmbeddedContent())

This is the config:

{
	"RootPath": "assets",
	"Recurse": true,
	"IncludePattern": "",
	"ExcludePattern": "(^\\.|\\.go$)",
	"OutputPath": "embeddedassets.go",
	"BuildConstraints": "",
	"PackageName": "sdm630",
	"DevOutputPath": "",
	"DevBuildConstraints": "",
	"MinifyTypes": {
		"\\.html?$": "text/html",
		"\\.css$": "text/css",
		"\\.js$": "application/javascript"
	},
	"CompressPattern": "\\.(js|css|html)$",
	"NoCompressPattern": "\\.(pe?g|png|gif|woff2?|eot|ttf|ico)$",
	"OverrideModDate": false
}

If you want to reproduce you can use https://github.com/gonium/gosdm630 and run like this:

make assets && go run -race cmd/sdm/main.go -s -u localhost:8080 -r 1 

I would appreciate any help as its driving me nuts...

from embed.

andig avatar andig commented on May 24, 2024

I've finally given up and switched to http://github.com/mjibson/esc which provides similar functionality for my purposes.

from embed.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.