[go-nuts] Go WASM question
I have sizable Go WASM application that creates map[string]interface{} and passes to JS or reads from JS library. Go maps do not have predefined key order. But JS has object property order predictable in JavaScript objects since ES2015. Problem: when JS objects are transferred from JS into Go and back they key order becomes scrambled. At this point I have a small fix inside JS application that simply reorders keys coming from Go back into JS. A bit of a hack but works. Question: is there better solution? My environment: 1. Go 1.13. 2. Chrome and Edge browsers. 3. Windows 10 desktop 64bits. -- 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/39a710e3-4e77-475f-9d1c-37e4a22148c6%40googlegroups.com.
[go-nuts] Re: Go 1.12 installer on Windows 7 (x64) problem
Yes, it was Windows 7 SP1 installation issue. Somehow only part of SP1 got applied during install. Once fixed Go installed without any issues. Thanks a lot. On Monday, March 4, 2019 at 1:04:16 PM UTC-5, Jake Montgomery wrote: > > I have seen posts, unrelated to Go, about installers not recognizing > Windows 7 SP1 as being installed. You did a screenshot of the update > history, but you should also check that it is listed under > Computer->Properties->Windows edition. See here > <https://visualstudio.microsoft.com/vs/support/version-windows-not-supported-youre-running-windows-7-try-installing-service-pack-1/>. > > > > While it is possible that this is a problem specific to the Go installer, > most likely it is not. So I suggest googling for other people with similar > issues installing other software. > > Good Luck. > > On Monday, March 4, 2019 at 11:06:51 AM UTC-5, Tad Vizbaras wrote: >> >> >> Go 1.12 installer on Windows 7 (x64) problem. >> >> Requires: Windows 7 with Service Pack 1. >> But Service Pack is installed and restart done twice (just to make sure). >> >> Screenshot attached. >> >> How can I get around installer? Can I force it skip the check? >> >> >> -- 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] Re: syscall/js: How to pass data from the browser back into Go?
Yes, I also use js.Value.String() . I have also looked at TypedArray, but that goes from Go into JS types as well. One example use case would be for calling JS splice function from Go. On Friday, October 5, 2018 at 2:04:01 PM UTC-4, Carl Mastrangelo wrote: > > While trying out the Wasm compiler, I noticed that the syscall/js mainly > has helper functions for converting Go types to Js types, but not the other > way around. I am trying to read the data from an HTML type="file"/>. I add an event listener for the `change` event and want to > read the file contents. The problem is that there doesn't seem to be a > way to convert between any dataformat window.FileReader (such as > ArrayBuffer, or a UInt8Array), and a []byte. My work around for now is > calling js.Value.String(), and parsing the comma separated decimal numbers. > > What is the correct way to do this? > > -- 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] Re: Go Webassembly runs out of memory on Android
Thank you. Will wait for official fix for this. Go WASM is nice. I have tried it in number of smaller projects. Ability to have single language on both client and server side is awesome. -- 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 Webassembly runs out of memory on Android
Go Webassembly runs out of memory on Android. Very simple app with just few event handlers. I had to use remote debugger to see console. There is resulting screenshot. Device is Samsung Galaxy S7 edge, model: SM-G935T. Used Go 1.11 windows/amd64. Simply used go build with GOOS=js and GOARCH=wasm. -- 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] How to post Form data using Go WASM?
I am struggling to get this working. How to post Form data to the web server using Go WASM? Do I use fetch API or XMLHttpRequest? -- 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] Re: How to find other packages using this package?
Found it: go list -f "{{.ImportPath}} {{.Imports}}" ./... | grep %1 Replace %1 with package you are looking for. Run this at GOPATH root to scan all packages. On Friday, August 17, 2018 at 12:08:48 PM UTC-4, Tad Vizbaras wrote: > > I have a package. Let say a/b/c. How to find what are other packages in my > GOPATH using it? > > I am basically trying to clean up GOPATH from all unused packages > installed and downloaded over the years. > Finding "dead" packages in GOPATH. > > Tried go list and go doc but only got list of dependencies: packages this > package depends on. > -- 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] How to find other packages using this package?
I have a package. Let say a/b/c. How to find what are other packages in my GOPATH using it? I am basically trying to clean up GOPATH from all unused packages installed and downloaded over the years. Finding "dead" packages in GOPATH. Tried go list and go doc but only got list of dependencies: packages this package depends on. -- 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] Gift wrap errors or not?
It has been almost two years since this post: https://dave.cheney.net/2016/06/12/stack-traces-and-the-errors-package What is current best practice? Should I use some package to gift wrap errors in order to get stack trace attached to them? Standard library errors package is really "bare bones". Some guidance would be appreciated. -- 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] Re: public key in pem file to X509.Certificate?
Found it. The key is to use function x509.ParseCertificate(block.Bytes) . Code below is not clean but should help anyone looking for a way to parse pem file into x509.Certificate. f, err := os.Open(sn.recpCertFile) if err != nil { log.Fatal(err) } defer f.Close() pubPEM, err := ioutil.ReadAll(f) if err != nil { log.Fatal(err) } block, _ := pem.Decode(pubPEM) if block == nil { log.Fatal("failed to parse PEM block containing the public key") } cert, err := x509.ParseCertificate(block.Bytes) if err != nil { log.Fatal(err) } -- 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] Re: public key in pem file to X509.Certificate?
Note: I know how to get to *rsa.PublicKey from pem file. Probably missing something really obvious. On Thursday, February 1, 2018 at 11:07:38 AM UTC-5, Tad Vizbaras wrote: > > How to get X509.Certificate struct from public key in pem file? > > -- 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] public key in pem file to X509.Certificate?
How to get X509.Certificate struct from public key in pem file? -- 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] Re: X509 pem RSA example?
I just realized that encryption and signing (optional) has to be done for S/MIME and PKCS7. Does standard library covers this? -- 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] Re: X509 pem RSA example?
Very helpful. Thanks. Can I use 3DES encryption instead of sha256.New() ? Inside this call: ciphertext, err := rsa.EncryptOAEP(sha256.New(), rng, &public, secretMessage, label) -- 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] X509 pem RSA example?
Looking for source code example on how to load private/public key from .pem file. Then use it to encrypt/decrypt/sign using RSA. Standard library examples are too low level. My requirement is rather basic: load pem file and then use various RSA functions. I was looking at rsa.EncryptOAEP but can not find a way to load "pub *PublicKey" from pem file. -- 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] Re: Experience Report building OCR in Go
Yes, that what I have used. I feel that package https://github.com/pkg/errors is good enough to be in the standard library. At least part of it that does stack trace. In all respects Go worked very well for this project. -- 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] Re: Race detector for Windows GUI apps. "go build -race" asks for gcc. Why?
Summary: adding *.syso file to main packages directory stops normal race detector enabled build on windows/amd64. This in essence prevents race detection on Windows apps with GUI interface that use binary resources (icons, etc.). -- 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] Race detector for Windows GUI apps. "go build -race" asks for gcc. Why?
This is windows/amd64 setup. go build -race works in other scenarios. Example: building console apps. It also works if *.syso file with binary resources (icons, etc.) is NOT in the build directory. Once you place rsrc.syso or any *.syso "go build -race" stops working. There is the output: go build -race # xtrans/prod/xtrunwui C:\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exec: "gcc": executable file not found in %PATH% None of the source files uses import "C" and I do not want to install C for this since if there is no *.syso file then build -race works. Unfortunately there are icons in rsrc.syso and GUI app simply does not run without them. -- 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] Re: Experience Report building OCR in Go
I used "walk" for prototyping but found it too complex. I do not mean this as criticism. "walk" uses many closures to init controls and get GUI working. This is fine if you are into this style of programming. I find reading "walk" internal code challenging. "walk" was an inspiration. It is possible to build Go Windows GUI apps without C compiler. In terms of timing it took 1 solid month by 1 developer to get Windows GUI packages working. -- 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] Re: Experience Report building OCR in Go
OCR project started 2 years ago. Then there was no usable exp/shiny. I still think that GUI frameworks for Go are in baby stages even today. Why would I resort to some C libraries when "syscall" works with Windows API well? On Tuesday, January 16, 2018 at 3:45:22 AM UTC-5, Egon wrote: > > As for getting andlabs/ui compiling the easiest I've found is to use > msys2... > > > i.e. installation from scratch: > > 1. http://www.msys2.org/ > 2. open msys shell > 3. pacman -Syu > 3.1 close from X > 4. pacman -Su > 5. pacman -S mingw-w64-x86_64-go > 6. pacman -S --needed base-devel mingw-w64-i686-toolchain > mingw-w64-x86_64-toolchain > > But, yeah... it could be much, much easier. > > On Tuesday, 16 January 2018 10:41:23 UTC+2, Egon wrote: >> >> Not sure why you had to build a GUI separately, there are already a few >> libs, although some of them are still barebones... >> >> https://github.com/lxn/walk >> https://github.com/andlabs/ui >> >> Of course there are also bindings for gtk and qt. >> >> On Monday, 15 January 2018 22:32:33 UTC+2, Tad Vizbaras wrote: >>> >>> Experience Report building OCR in Go: >>> >>> http://recoink.com/goreport >>> >>> >>> -- 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] Experience Report building OCR in Go
Experience Report building OCR in Go: http://recoink.com/goreport -- 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] Re: JSON decoding
Looks like I found the solution in https://golang.org/pkg/encoding/json/#Decoder.Decode Example (Stream). This should do it. On Tuesday, December 19, 2017 at 11:11:25 AM UTC-5, Tad Vizbaras wrote: > > > I have this: > > type Runner interface { > TaskName() string > Run(ctx context.Context) error > } > > type Job struct { > Tasks []Runner > } > > 1. I have number of structs that implement Runner interface and get added > into slice of Tasks. > > 2. I use json.Encoder to save Job into JSON file. > > 3. But when I try to load JSON back via json.Decoder I get error: > "json: cannot unmarshal object into Go struct field Job.Tasks of type > serv.Runner" > I guess unmarshaller does not have enough information in saved JSON to > restore specific > structs. > > Question: what would be right design decision? Add extra metadata to > structs that > implement Runner and restore structs manually via type assertion of > interface{} during load? > > Thanks a lot for any help. > -- 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] JSON decoding
I have this: type Runner interface { TaskName() string Run(ctx context.Context) error } type Job struct { Tasks []Runner } 1. I have number of structs that implement Runner interface and get added into slice of Tasks. 2. I use json.Encoder to save Job into JSON file. 3. But when I try to load JSON back via json.Decoder I get error: "json: cannot unmarshal object into Go struct field Job.Tasks of type serv.Runner" I guess unmarshaller does not have enough information in saved JSON to restore specific structs. Question: what would be right design decision? Add extra metadata to structs that implement Runner and restore structs manually via type assertion of interface{} during load? Thanks a lot for any help. -- 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] Re: How to read multi-page TIFF image?
If you implement decoder I can provide sample multi-page TIFF files to see if it is working. On Sunday, September 24, 2017 at 2:48:50 PM UTC-4, Andrew O'Neill wrote: > > A while ago I reading Adobe's doc's on SubIFD's since that is needed for > decoding Nikon's RAW files. Is this a similar thing or is it just reading > all the IFD's? I plan to implement a SubIFD decoder for tiff, unless > someone else has done it. > > On Sun, Sep 24, 2017 at 8:21 PM Tad Vizbaras > wrote: > >> Sad. >> >> Any chance to add multi page support to this? I am in desperate need for >> multi-page TIFF support. >> >> >> On Sunday, September 24, 2017 at 9:20:31 AM UTC-4, Guy Allard wrote: >>> >>> This package does not appear to support multi-page TIFs. Decoder >>> initialization only reads the 1st IFD. >>> >>> On Friday, September 22, 2017 at 1:49:47 PM UTC-4, Tad Vizbaras wrote: >>>> >>>> No problem reading single page TIFF images using: >>>> "golang.org/x/image/tiff". >>>> >>>> It works great. >>>> >>>> >>>> Question: how to read multi-page scanned TIFFs? How to access pages 2, 3, >>>> etc.? >>>> >>>> >>>> -- >> 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.
[go-nuts] Re: How to read multi-page TIFF image?
Sad. Any chance to add multi page support to this? I am in desperate need for multi-page TIFF support. On Sunday, September 24, 2017 at 9:20:31 AM UTC-4, Guy Allard wrote: > > This package does not appear to support multi-page TIFs. Decoder > initialization only reads the 1st IFD. > > On Friday, September 22, 2017 at 1:49:47 PM UTC-4, Tad Vizbaras wrote: >> >> No problem reading single page TIFF images using: "golang.org/x/image/tiff". >> >> It works great. >> >> >> Question: how to read multi-page scanned TIFFs? How to access pages 2, 3, >> etc.? >> >> >> -- 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] How to read multi-page TIFF image?
No problem reading single page TIFF images using: "golang.org/x/image/tiff". It works great. Question: how to read multi-page scanned TIFFs? How to access pages 2, 3, etc.? -- 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] Re: glog log rotate not working correctly
There is also library called lumberjack. It integrates nicely with standard library. quote: `Lumberjack is a Go package for writing logs to rolling files.` https://github.com/natefinch/lumberjack -- 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] Zero value of the map
Thank you for detailed explanation. I find myself never using "var a map[int]int" or similar var like map. Maybe just my limited understanding. But I am glad we end up with map[int]int instead of *map[int]int. -- 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] Zero value of the map
Making zero value useful is great idea. It works for slice, mutex and many others. var a []int a = append(a, 1) fmt.Println(a) This works and prints: [1] Sadly maps do not seem to have useful zero value. They require call to make() or literal to get to useful state. var a map[int]int a[1] = 1 // Fails with panic. // panic: assignment to entry in nil map Zero value maps are read-only. var a map[int]int fmt.Println(len(a)) // Works and prints 0. The argument could be that slices are read-only too. Just that "append" is special and it makes zero value slices useful. var a []int a[0] = 1 // Fails. // panic: runtime error: index out of range I am just curious what is the reason behind not making zero maps more useful? Is it space? -- 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] What is use for [:] of a slice?
Slicing is useful but is there a difference between simple slice assignment and [:] ? Like this: A := []int{1, 2, 3} b := A[:] vs. b := A Why would I want to use A[:] if A is a slice? If A is an array I would understand. But it is a slice. I found this in some third party library and got puzzled. -- 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.