Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON parse error #829

Closed
rutigl opened this issue Feb 8, 2024 · 2 comments
Closed

JSON parse error #829

rutigl opened this issue Feb 8, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@rutigl
Copy link

rutigl commented Feb 8, 2024

What version of Garble and Go are you using?

$ garble version 0.11.0

$ go version 1.21.5

What environment are you running Garble on?

go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\mglushki\AppData\Local\go-build
set GOENV=C:\Users\mglushki\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\mglushki\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\mglushki\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.21.5
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=c:\Users\mglushki\go\Dell\src\report\go.mod
set GOWORK=c:\Users\mglushki\go\Dell\go.work
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\mglushki\AppData\Local\Temp\go-build2032865526=/tmp/go-build -gno-record-gcc-switches

What did you do?

My application creates json file.
Instead of running go build, I run
garble -literals -seed=random -tiny build
Here is some code from my application:

package main
import (
	"encoding/json"
	"flag"
	"fmt"	
)
type DeviceData struct {
	UID    string `json:"UID"`
	DMEKey string `json:"DME_KEY"`
}
type Header struct {
	Version      int    `json:"version"`
	ID           int    `json:"ID"`
	Size         int    `json:"size"`
	Timestamp    string `json:"timestamp"`
	DMEAlgorithm string `json:"DMEalgorithm"`
}
type Signature struct {
	Issuer string `json:"issuer"`
	Hash   string `json:"hash"`
	Value  string `json:"value"`
}
type Manifest struct {
	Manifest struct {
		Header    Header       `json:"header"`
		Content   []DeviceData `json:"content"`
		Signature Signature    `json:"signature"`
	} `json:"manifest"`
}

What did you expect to see?

receive report.exe without errors

What did you see instead?

report

:6: cannot use struct{UD9EZ69LsH Header json:"header"; IOsqDhsqaqq []DeviceData json:"content"; C3ZvWW53w Signature json:"signature"}{…} (value of type struct{UD9EZ69LsH Header "json:"header""; IOsqDhsqaqq []DeviceData "json:"content""; C3ZvWW53w Signature "json:"signature""}) as struct{Header Header "json:"header""; Content []DeviceData "json:"content""; Signature Signature "json:"signature""} value in struct literal
exit status 2
exit status 1

@lu4p
Copy link
Member

lu4p commented Feb 8, 2024

This is the same cause as #799

@lu4p lu4p added the bug Something isn't working label Feb 8, 2024
@mvdan
Copy link
Member

mvdan commented Feb 18, 2024

This issue report doesn't have enough information to reproduce the error, and like @lu4p says, it looks very similar to #799. Closing as a duplicate for now.

@mvdan mvdan closed this as not planned Won't fix, can't repro, duplicate, stale Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants