You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type parameters struct {
Filepath string `short:"f" long:"filepath" required:"true" description:"File-path of image"`
PrintAsJson bool `short:"j" long:"json" description:"Print out as JSON"`
IsVerbose bool `short:"v" long:"verbose" description:"Print logging"`
ThumbnailOutputFilepath string `short:"t" long:"thumbnail-output-filepath" description:"File-path to write thumbnail to (if present)"`
DoNotPrintTags bool `short:"n" long:"no-tags" description:"Do not actually print tags. Good for auditing the logs or merely checking the EXIF structure for errors."`
SkipBlocks int `short:"s" long:"skip" description:"Skip this many EXIF blocks before returning"`
DoUniversalTagSearch bool `short:"u" long:"universal-tags" description:"If tags not found in known mapped IFDs, fallback to trying all IFDs."`
}
var (
arguments = new(parameters)
)
...
func main() {
...
_, err := flags.Parse(arguments)
if err != nil {
os.Exit(-1)
}
...
}
If you accidentally pass -filepath instead of --filepath, two things should happen: 1) 'ilepath' should be taken as the argument and go-flags should fail due to the provided argument now being an extra. However, it parses successfully and returned control to the caller, just to fail due to it being an invalid file-path.
Both of these have the same result:
$ go run command/exif-read-tool/main.go -filepath
Stack:
*fs.PathError open ilepath: no such file or directory
/home/dustin/go/src/github.com/dsoprea/go-exif/v3/command/exif-read-tool/main.go:92 (0x5cb7f7)
main: log.PanicIf(err)
/usr/local/go/src/runtime/proc.go:225 (0x437cb6)
main: fn()
/usr/local/go/src/runtime/asm_amd64.s:1371 (0x468041)
goexit: BYTE $0x90 // NOP
exit status 254
$ go run command/exif-read-tool/main.go -filepath assets/gps.jpg
Stack:
*fs.PathError open ilepath: no such file or directory
/home/dustin/go/src/github.com/dsoprea/go-exif/v3/command/exif-read-tool/main.go:92 (0x5cb7f7)
main: log.PanicIf(err)
/usr/local/go/src/runtime/proc.go:225 (0x437cb6)
main: fn()
/usr/local/go/src/runtime/asm_amd64.s:1371 (0x468041)
goexit: BYTE $0x90 // NOP
exit status 254
This is my argument configuration:
If you accidentally pass
-filepath
instead of--filepath
, two things should happen: 1) 'ilepath' should be taken as the argument and go-flags should fail due to the provided argument now being an extra. However, it parses successfully and returned control to the caller, just to fail due to it being an invalid file-path.Both of these have the same result:
REF: dsoprea/go-exif#61
The text was updated successfully, but these errors were encountered: