[go-nuts] When using 'go mod vendor' why are there lots of files missing?
When using 'go mod vendor' why are there lots of files missing? I'm converting packages from using Dep to using the new modules and there are mismatches in the vendor folder structure. Does this command only vendor the actual files used for compilation? Because a lot of tests and examples are missing from the vendor directory of each package. -- 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. For more options, visit https://groups.google.com/d/optout.
[go-nuts] `go mod download -json` does not product valid json?
`go mod download -json` does not product valid json? Is this a known issue or am I missing something? -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] `go mod download -json` does not product valid json?
I simply run `go mod download -json` and it outputs this (which isn't valid.) { "Path": "github.com/fatih/color", "Version": "v1.7.0", "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/github.com/fatih/color/@v/v1.7.0.info" , "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/github.com/fatih/color/@v/v1.7.0.mod" , "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/github.com/fatih/color/@v/v1.7.0.zip" , "Dir": "/media/Data/Projects/Go/pkg/mod/github.com/fatih/color@v1.7.0", "Sum": "h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=", "GoModSum": "h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=" } { "Path": "github.com/mattn/go-colorable", "Version": "v0.0.9", "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/github.com/mattn/go-colorable/@v/v0.0.9.info" , "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/github.com/mattn/go-colorable/@v/v0.0.9.mod" , "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/github.com/mattn/go-colorable/@v/v0.0.9.zip" , "Dir": "/media/Data/Projects/Go/pkg/mod/github.com/mattn/go-colorable@v0.0.9", "Sum": "h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=", "GoModSum": "h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=" } { "Path": "github.com/mattn/go-isatty", "Version": "v0.0.4", "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/github.com/mattn/go-isatty/@v/v0.0.4.info" , "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/github.com/mattn/go-isatty/@v/v0.0.4.mod" , "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/github.com/mattn/go-isatty/@v/v0.0.4.zip" , "Dir": "/media/Data/Projects/Go/pkg/mod/github.com/mattn/go-isatty@v0.0.4", "Sum": "h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=", "GoModSum": "h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=" } { "Path": "golang.org/x/sys", "Version": "v0.0.0-20181005133103-4497e2df6f9e", "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/golang.org/x/sys/@v/v0.0.0-20181005133103-4497e2df6f9e.info" , "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/golang.org/x/sys/@v/v0.0.0-20181005133103-4497e2df6f9e.mod" , "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/golang.org/x/sys/@v/v0.0.0-20181005133103-4497e2df6f9e.zip" , "Dir": "/media/Data/Projects/Go/pkg/mod/golang.org/x/sys@v0.0.0-20181005133103-4497e2df6f9e" , "Sum": "h1:EfdBzeKbFSvOjoIqSZcfS8wp0FBLokGBEs9lz1OtSg0=", "GoModSum": "h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=" } On Saturday, 6 October 2018 16:24:42 UTC+1, Ian Davis wrote: > > On Sat, 6 Oct 2018, at 3:07 PM, 'kalekold' via golang-nuts wrote: > > `go mod download -json` does not product valid json? Is this a known issue > or am I missing something? > > > Do you have an example that shows the invalid json? > > -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] `go mod download -json` does not product valid json?
It should be: [{ "Path": "github.com/fatih/color", "Version": "v1.7.0", "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/ github.com/fatih/color/@v/v1.7.0.info", "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/ github.com/fatih/color/@v/v1.7.0.mod", "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/ github.com/fatih/color/@v/v1.7.0.zip", "Dir": "/media/Data/Projects/Go/pkg/mod/github.com/fatih/color@v1.7.0", "Sum": "h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=", "GoModSum": "h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=" },{ ... }] Notice the array, it's missing in the example above. This means this output can not be parsed. On Saturday, 6 October 2018 17:24:35 UTC+1, kalekold wrote: > > I simply run `go mod download -json` and it outputs this (which isn't > valid.) > > { > "Path": "github.com/fatih/color", > "Version": "v1.7.0", > "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/ > github.com/fatih/color/@v/v1.7.0.info", > "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/ > github.com/fatih/color/@v/v1.7.0.mod", > "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/ > github.com/fatih/color/@v/v1.7.0.zip", > "Dir": "/media/Data/Projects/Go/pkg/mod/github.com/fatih/color@v1.7.0", > "Sum": "h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=", > "GoModSum": "h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=" > } > { > "Path": "github.com/mattn/go-colorable", > "Version": "v0.0.9", > "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/ > github.com/mattn/go-colorable/@v/v0.0.9.info", > "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/ > github.com/mattn/go-colorable/@v/v0.0.9.mod", > "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/ > github.com/mattn/go-colorable/@v/v0.0.9.zip", > "Dir": "/media/Data/Projects/Go/pkg/mod/ > github.com/mattn/go-colorable@v0.0.9", > "Sum": "h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=", > "GoModSum": "h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=" > } > { > "Path": "github.com/mattn/go-isatty", > "Version": "v0.0.4", > "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/ > github.com/mattn/go-isatty/@v/v0.0.4.info", > "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/ > github.com/mattn/go-isatty/@v/v0.0.4.mod", > "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/ > github.com/mattn/go-isatty/@v/v0.0.4.zip", > "Dir": "/media/Data/Projects/Go/pkg/mod/github.com/mattn/go-isatty@v0.0.4 > ", > "Sum": "h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=", > "GoModSum": "h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=" > } > { > "Path": "golang.org/x/sys", > "Version": "v0.0.0-20181005133103-4497e2df6f9e", > "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/ > golang.org/x/sys/@v/v0.0.0-20181005133103-4497e2df6f9e.info", > "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/ > golang.org/x/sys/@v/v0.0.0-20181005133103-4497e2df6f9e.mod", > "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/ > golang.org/x/sys/@v/v0.0.0-20181005133103-4497e2df6f9e.zip", > "Dir": "/media/Data/Projects/Go/pkg/mod/ > golang.org/x/sys@v0.0.0-20181005133103-4497e2df6f9e", > "Sum": "h1:EfdBzeKbFSvOjoIqSZcfS8wp0FBLokGBEs9lz1OtSg0=", > "GoModSum": "h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=" > } > > > On Saturday, 6 October 2018 16:24:42 UTC+1, Ian Davis wrote: >> >> On Sat, 6 Oct 2018, at 3:07 PM, 'kalekold' via golang-nuts wrote: >> >> `go mod download -json` does not product valid json? Is this a known >> issue or am I missing something? >> >> >> Do you have an example that shows the invalid json? >> >> -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] `go mod download -json` does not product valid json?
Thanks for the reply. I'm decoding successfully now. On Sunday, 7 October 2018 21:19:47 UTC+1, Paul Jolly wrote: > > > It looks like it is a stream of JSON objects? > > > > If so, I suspect this is expected? > > Per the issue you linked, thepudds, absolutely correct. > > This comment gives details on how to handle such a stream of JSON objects: > > https://github.com/golang/go/issues/27655#issuecomment-420993215 > > > Paul > -- 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. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Should you commit a 'go.mod' file that contains a Replace directive to a repository?
When should you use the Replace directive in a 'go.mod' file? Is this feature only useful for debugging and development? The reason I ask is that you can use the Replace directive to point to an arbitrary location on disk as well as a normal downloaded package. So does that mean that committing a 'go.mod' file that contains a Replace directive to a repo is bad practice? Because consumers of that repo might not have the replacement source. -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] Having trouble installing golint
I've already tried that and the original command still fails. $ go get -u -v golang.org/x/lint/golint Fetching https://golang.org/x/lint/golint?go-get=1 Parsing meta tags from https://golang.org/x/lint/golint?go-get=1 (status code 200) get "golang.org/x/lint/golint": found meta tag get.metaImport{Prefix: "golang.org/x/lint", VCS:"git", RepoRoot:"https://go.googlesource.com/lint"} at https://golang.org/x/lint/golint?go-get=1 get "golang.org/x/lint/golint": verifying non-authoritative meta tag Fetching https://golang.org/x/lint?go-get=1 Parsing meta tags from https://golang.org/x/lint?go-get=1 (status code 200) golang.org/x/lint (download) Fetching https://golang.org/x/lint?go-get=1 Parsing meta tags from https://golang.org/x/lint?go-get=1 (status code 200) get "golang.org/x/lint": found meta tag get.metaImport{Prefix: "golang.org/x/lint", VCS:"git", RepoRoot:"https://go.googlesource.com/lint"} at https://golang.org/x/lint?go-get=1 Fetching https://golang.org/x/tools/go/ast/astutil?go-get=1 Parsing meta tags from https://golang.org/x/tools/go/ast/astutil?go-get=1 (status code 200) get "golang.org/x/tools/go/ast/astutil": found meta tag get.metaImport{ Prefix:"golang.org/x/tools", VCS:"git", RepoRoot: "https://go.googlesource.com/tools"} at https: //golang.org/x/tools/go/ast/astutil?go-get=1 get "golang.org/x/tools/go/ast/astutil": verifying non-authoritative meta tag Fetching https://golang.org/x/tools?go-get=1 Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200) golang.org/x/tools (download) Fetching https://golang.org/x/tools/go/gcexportdata?go-get=1 Parsing meta tags from https://golang.org/x/tools/go/gcexportdata?go-get=1 (status code 200) get "golang.org/x/tools/go/gcexportdata": found meta tag get.metaImport{ Prefix:"golang.org/x/tools", VCS:"git", RepoRoot: "https://go.googlesource.com/tools"} at https: //golang.org/x/tools/go/gcexportdata?go-get=1 get "golang.org/x/tools/go/gcexportdata": verifying non-authoritative meta tag Fetching https://golang.org/x/tools/go/internal/gcimporter?go-get=1 Parsing meta tags from https://golang.org/x/tools/go/internal/gcimporter?go-get=1 (status code 200) get "golang.org/x/tools/go/internal/gcimporter": found meta tag get. metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot: "https://go.googlesource.com/tools"} at https: //golang.org/x/tools/go/internal/gcimporter?go-get=1 get "golang.org/x/tools/go/internal/gcimporter": verifying non-authoritative meta tag $ go get -u -v github.com/golang/lint/golint github.com/golang/lint (download) package github.com/golang/lint/golint: code in directory /media/Data/ Projects/Go/src/github.com/golang/lint/golint expects import "golang.org/x/lint/golint" On Wednesday, 17 October 2018 17:53:50 UTC+1, Sam Whited wrote: > > As the error says, you need to use golang.org/x/lint/golint: > > go get -u -v golang.org/x/lint/golint > > —Sam > > On Wed, Oct 17, 2018, at 10:12, gary.wi...@victoriaplumb.com > wrote: > > I'm having trouble installing golint. Any idea what the problem could > be? > > > > $ go get -u -v github.com/golang/lint/golint > > github.com/golang/lint (download) > > package github.com/golang/lint/golint: code in directory > /home/gary/Code/go/ > > src/github.com/golang/lint/golint expects import " > golang.org/x/lint/golint" > > > > -- > > 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...@googlegroups.com . > > For more options, visit https://groups.google.com/d/optout. > > > -- > Sam Whited > s...@samwhited.com > -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] Having trouble installing golint
It must have been a configuration issue on the remote server because it all works fine now. On Wednesday, 17 October 2018 22:05:48 UTC+1, Sam Whited wrote: > > TL;DR — you don't need to run the second command, just the first one. > > I'm sorry for being unclear. Go get looks up packages by their import > path. The import path of golint is "golang.org/x/lint/golint", so the > second command you ran with the github URL will never work since that is > the repo, not the package path. When you run go get > golang.org/x/lint/golint it will look up the repo, discover that it lives > at GitHub, clone it, and build it. > > If you don't specify another package import path and you host your source > on GitHub the github.com url is the default one, which may be why you are > confused. However, golint specifies a custom import path ( > golang.org/x/lint/golint) so you need to use that. > > —Sam > > On Wed, Oct 17, 2018, at 14:48, 'kalekold' via golang-nuts wrote: > > I've already tried that and the original command still fails. > > > > $ go get -u -v golang.org/x/lint/golint > > Fetching https://golang.org/x/lint/golint?go-get=1 > > Parsing meta tags from https://golang.org/x/lint/golint?go-get=1 > (status > > code 200) > > get "golang.org/x/lint/golint": found meta tag get.metaImport{Prefix: > > "golang.org/x/lint", VCS:"git", > > RepoRoot:"https://go.googlesource.com/lint"} > > at https://golang.org/x/lint/golint?go-get=1 > > get "golang.org/x/lint/golint": verifying non-authoritative meta tag > > Fetching https://golang.org/x/lint?go-get=1 > > Parsing meta tags from https://golang.org/x/lint?go-get=1 (status code > > 200) > > golang.org/x/lint (download) > > Fetching https://golang.org/x/lint?go-get=1 > > Parsing meta tags from https://golang.org/x/lint?go-get=1 (status code > > 200) > > get "golang.org/x/lint": found meta tag get.metaImport{Prefix: > > "golang.org/x/lint", VCS:"git", > > RepoRoot:"https://go.googlesource.com/lint"} > > at https://golang.org/x/lint?go-get=1 > > Fetching https://golang.org/x/tools/go/ast/astutil?go-get=1 > > Parsing meta tags from > > https://golang.org/x/tools/go/ast/astutil?go-get=1 > > (status code 200) > > get "golang.org/x/tools/go/ast/astutil": found meta tag get.metaImport{ > > Prefix:"golang.org/x/tools", VCS:"git", RepoRoot: > > "https://go.googlesource.com/tools"} at https: > > //golang.org/x/tools/go/ast/astutil?go-get=1 > > get "golang.org/x/tools/go/ast/astutil": verifying non-authoritative > > meta > > tag > > Fetching https://golang.org/x/tools?go-get=1 > > Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code > > 200) > > golang.org/x/tools (download) > > Fetching https://golang.org/x/tools/go/gcexportdata?go-get=1 > > Parsing meta tags from > > https://golang.org/x/tools/go/gcexportdata?go-get=1 > > (status code 200) > > get "golang.org/x/tools/go/gcexportdata": found meta tag > get.metaImport{ > > Prefix:"golang.org/x/tools", VCS:"git", RepoRoot: > > "https://go.googlesource.com/tools"} at https: > > //golang.org/x/tools/go/gcexportdata?go-get=1 > > get "golang.org/x/tools/go/gcexportdata": verifying non-authoritative > > meta > > tag > > Fetching https://golang.org/x/tools/go/internal/gcimporter?go-get=1 > > Parsing meta tags from > > https://golang.org/x/tools/go/internal/gcimporter?go-get=1 > > (status code 200) > > get "golang.org/x/tools/go/internal/gcimporter": found meta tag get. > > metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot: > > "https://go.googlesource.com/tools"} at https: > > //golang.org/x/tools/go/internal/gcimporter?go-get=1 > > get "golang.org/x/tools/go/internal/gcimporter": verifying non- > > authoritative > > meta tag > > > > $ go get -u -v github.com/golang/lint/golint > > github.com/golang/lint (download) > > package github.com/golang/lint/golint: code in directory /media/Data/ > > Projects/Go/src/github.com/golang/lint/golint expects import > > "golang.org/x/lint/golint" > > > > > > On Wednesday, 17 October 2018 17:53:50 UTC+1, Sam Whited wrote: > > > > > > As the error says, you need to use golang.org/x/lint/golint: > > > > > > go get -u
[go-nuts] What is the current status of generics in Go?
I saw a design document floating about sometime last year and there seemed to be a lot of thought going into implementing them? What is the current status and where can I read more? Thanks. -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] What is the current status of generics in Go?
Thanks. On Monday, 6 May 2019 21:55:19 UTC+1, Ian Lance Taylor wrote: > > On Mon, May 6, 2019 at 9:22 AM 'kalekold' via golang-nuts > > wrote: > > > > I saw a design document floating about sometime last year and there > seemed to be a lot of thought going into implementing them? What is the > current status and where can I read more? Thanks. > > There is continuing thought. There is a lot of feedback at > https://github.com/golang/go/wiki/Go2GenericsFeedback . > > Ian > -- 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/b52c720e-b617-438e-9492-48d17695476a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] Problems drawing on frames of an animated gif
I think the upload has ruined the frames. I'll try another gif tomorrow. On Saturday, 21 January 2017 16:57:15 UTC, andrey mirtchovski wrote: > > I see only a single frame in your source file. I ran your program on > another gif and got the expected result: > > http://i.imgur.com/HOnlU1q.gif > http://i.imgur.com/GnSUHQ1.gif > > On Sat, Jan 21, 2017 at 8:54 AM, kalekold via golang-nuts > > wrote: > > Hi, > > > > I'm trying to draw some text on an animated gif and I'm having a few > > problems. > > > > I have a source gif (attached as fire.gif) which I can decode fine and > pass > > the frames to the drawing lib. > > The problem occurs when I'm trying to replace the original frames with > ones > > I've modified. I always seem to get the same result (see attached > out.gif). > > The text seems to be drawn fine but the other frames which contain the > > animation seem to be missing. > > > > Here's the code: > > > > package main > > > > import ( > > "image" > > "image/draw" > > "image/gif" > > "log" > > "os" > > > > > > "github.com/fogleman/gg" > > ) > > > > func main() { > > > > in, err := os.Open("/home/gary/Desktop/fire.gif") > > if err != nil { > > log.Fatalln(err) > > } > > defer in.Close() > > > > decoded, err := gif.DecodeAll(in) > > if err != nil { > > log.Fatalln(err) > > } > > > > for x := 0; x < len(decoded.Image); x++ { > > frame := decoded.Image[x] > > ctx := gg.NewContextForImage(frame) > > ctx.SetHexColor("#FFF") > > ctx.DrawStringWrapped("Lorem ipsum dolor sit amet", 10, 10, 0, > 0, > > 500, 1.4, gg.AlignLeft) > > > > palImg := image.NewPaletted(frame.Bounds(), frame.Palette) > > draw.FloydSteinberg.Draw(palImg, frame.Bounds(), ctx.Image(), > > image.ZP) > > > > decoded.Image[x] = palImg > > } > > > > out, err := os.Create("/home/gary/Desktop/out.gif") > > if err != nil { > > log.Fatalln(err) > > } > > defer out.Close() > > > > err = gif.EncodeAll(out, decoded) > > if err != nil { > > log.Fatalln(err) > > } > > } > > > > > > Any ideas how to compile the changed frame to give me the correct > output? > > > > -- > > 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...@googlegroups.com . > > For more options, visit https://groups.google.com/d/optout. > -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] Problems drawing on frames of an animated gif
Hmm.. the source gif I'm using must be compressed. Doesn't Go handle compressed gifs in the same way? When you say 'I may get unexpected results' is that because the current gif package doesn't support compression? On Sunday, 22 January 2017 02:47:13 UTC, andrey mirtchovski wrote: > > just as a warning, you may get unexpected results if you're working > with "compressed" gifs. i.e., file where the next frame is only the > difference between this one and the previous one. there are also > interlaced gifs, etc. i suggest you use "gifsicle" (available on > linux) to expand the gif first and then try with that if the original > doesn't work as well as you'd hoped. not sure if go's gif package > supports all optimizations. > > https://www.lcdf.org/gifsicle/ > > On Sat, Jan 21, 2017 at 4:28 PM, kalekold via golang-nuts > > wrote: > > I think the upload has ruined the frames. I'll try another gif tomorrow. > > > > On Saturday, 21 January 2017 16:57:15 UTC, andrey mirtchovski wrote: > >> > >> I see only a single frame in your source file. I ran your program on > >> another gif and got the expected result: > >> > >> http://i.imgur.com/HOnlU1q.gif > >> http://i.imgur.com/GnSUHQ1.gif > >> > >> On Sat, Jan 21, 2017 at 8:54 AM, kalekold via golang-nuts > >> wrote: > >> > Hi, > >> > > >> > I'm trying to draw some text on an animated gif and I'm having a few > >> > problems. > >> > > >> > I have a source gif (attached as fire.gif) which I can decode fine > and > >> > pass > >> > the frames to the drawing lib. > >> > The problem occurs when I'm trying to replace the original frames > with > >> > ones > >> > I've modified. I always seem to get the same result (see attached > >> > out.gif). > >> > The text seems to be drawn fine but the other frames which contain > the > >> > animation seem to be missing. > >> > > >> > Here's the code: > >> > > >> > package main > >> > > >> > import ( > >> > "image" > >> > "image/draw" > >> > "image/gif" > >> > "log" > >> > "os" > >> > > >> > > >> > "github.com/fogleman/gg" > >> > ) > >> > > >> > func main() { > >> > > >> > in, err := os.Open("/home/gary/Desktop/fire.gif") > >> > if err != nil { > >> > log.Fatalln(err) > >> > } > >> > defer in.Close() > >> > > >> > decoded, err := gif.DecodeAll(in) > >> > if err != nil { > >> > log.Fatalln(err) > >> > } > >> > > >> > for x := 0; x < len(decoded.Image); x++ { > >> > frame := decoded.Image[x] > >> > ctx := gg.NewContextForImage(frame) > >> > ctx.SetHexColor("#FFF") > >> > ctx.DrawStringWrapped("Lorem ipsum dolor sit amet", 10, 10, > 0, > >> > 0, > >> > 500, 1.4, gg.AlignLeft) > >> > > >> > palImg := image.NewPaletted(frame.Bounds(), frame.Palette) > >> > draw.FloydSteinberg.Draw(palImg, frame.Bounds(), ctx.Image(), > >> > image.ZP) > >> > > >> > decoded.Image[x] = palImg > >> > } > >> > > >> > out, err := os.Create("/home/gary/Desktop/out.gif") > >> > if err != nil { > >> > log.Fatalln(err) > >> > } > >> > defer out.Close() > >> > > >> > err = gif.EncodeAll(out, decoded) > >> > if err != nil { > >> > log.Fatalln(err) > >> > } > >> > } > >> > > >> > > >> > Any ideas how to compile the changed frame to give me the correct > >> > output? > >> > > >> > -- > >> > 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...@googlegroups.com. > >> > For more options, visit https://groups.google.com/d/optout. > > > > -- > > 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...@googlegroups.com . > > For more options, visit https://groups.google.com/d/optout. > -- 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. For more options, visit https://groups.google.com/d/optout.