diff --git a/goversioninfo.go b/goversioninfo.go index 42701c0..401e814 100644 --- a/goversioninfo.go +++ b/goversioninfo.go @@ -182,13 +182,11 @@ func (vi *VersionInfo) Walk() { // arch must be an architecture string accepted by coff.Arch, like "386" or "amd64" func (vi *VersionInfo) WriteSyso(filename string, arch string) error { - // Channel for generating IDs - newID := make(chan uint16) - go func() { - for i := uint16(1); ; i++ { - newID <- i - } - }() + var i uint16 + newID := func() uint16 { + i++ + return i + } // Create a new RSRC section rsrc := coff.NewRSRC() @@ -211,7 +209,7 @@ func (vi *VersionInfo) WriteSyso(filename string, arch string) error { } defer manifest.Close() - id := <-newID + id := newID() rsrc.AddResource(rtManifest, id, manifest) } diff --git a/icon.go b/icon.go index 87e27b7..bbbe914 100644 --- a/icon.go +++ b/icon.go @@ -58,7 +58,7 @@ type gRPICONDIRENTRY struct { ID uint16 } -func addIcon(coff *coff.Coff, fname string, newID <-chan uint16) error { +func addIcon(coff *coff.Coff, fname string, newID func() uint16) error { f, err := os.Open(fname) if err != nil { return err @@ -77,9 +77,9 @@ func addIcon(coff *coff.Coff, fname string, newID <-chan uint16) error { Type: 1, // magic num. Count: uint16(len(icons)), }} - gid := <-newID + gid := newID() for _, icon := range icons { - id := <-newID + id := newID() buff, err := bufferIcon(f, int64(icon.ImageOffset), int(icon.BytesInRes)) if err != nil { return err