On Fri, 18 Dec 2020, 11:44 pm Volker Dobler, <dr.volker.dob...@gmail.com> wrote:
> Use > > import _ "embed" // note the _ > > Your code does not use package embed. A comment does > not qualify as usage. As yous must import it for //go:embed > comments to work you have to use a "side-effects-only"-import. > Ah yes. This should be mentioned in the package documentation. Probably it is not. Thank you. > > V. > > On Friday, 18 December 2020 at 13:38:10 UTC+1 amits...@gmail.com wrote: > >> Hi all, has anyone tried using the “embed” package in the 1.16 beta 1 >> release? >> >> My data.go file looks as: >> >> package main >> >> import "embed" >> >> //go:embed templates/main.go.tmpl >> var tmplMainGo []byte >> >> >> When I build the program, I get this: >> >> ~/go/bin/go1.16beta1 build >> # github.com/amitsaha/go-embed >> ./data.go:3:8: imported and not used: “embed” >> >> >> Now, I understand the error, but what’s the fix? I blindly tried to >> remove the import, but then I get: >> >> # github.com/amitsaha/go-embed >> ./data.go:5:3: //go:embed only allowed in Go files that import “embed" >> >> What am I doing wrong? >> >> My test code is here: https://github.com/amitsaha/go-embed >> >> Thank you. >> >> Best Regards, >> Amit. >> >> >> >> -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/0552d6cc-93be-49f6-96c0-cd1679854460n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/0552d6cc-93be-49f6-96c0-cd1679854460n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CANODV3k5zQA9z8tL8HAc42Kp2Sv6qwMC9KNP4L%2Bfg%2B0oGN44Yg%40mail.gmail.com.