ffjson icon indicating copy to clipboard operation
ffjson copied to clipboard

[go 1.5] Unable to run ffjson against application packages

Open remh opened this issue 10 years ago • 2 comments

Hi

Since i upgraded to go 1.5.2, whenever i try to run ffjson against a file that is on the "main" package i'm getting the following error:

$ ffjson foobar.go
Error: Go Run Failed for: /tmp/ffjson-inception167280481.go
STDOUT:

STDERR:
/tmp/ffjson-inception167280481.go:8:2: import "github.com/foo/bar/foobar" is a program, not an importable package
$ go version
go version go1.5.2 linux/amd64

foobar.go

package main

import "fmt"

type FooStruct struct {
    Bar string `json:"bar"`
    Buz int  `json:"buz"`
}

func main() {
    var foobarbuz FooStruct
    foobarbuz.Buz = 42
    fmt.Println(foobarbuz)
}

remh avatar Dec 10 '15 19:12 remh

Any thoughts on adding this to the README? It's a pretty serious gotcha.

I looked into improving the error message, which would probably be my first preference, but I guess the error is thrown directly from the standard library.

brandur avatar Mar 18 '16 22:03 brandur

Any workarounds or explanation of this issue?

divan avatar Aug 14 '17 10:08 divan