github.com/likebike/go--@v0.0.0-20190911215757-0bd925d16e96/go/src/encoding/gob/dump.go (about) 1 // Copyright 2009 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // +build ignore 6 7 package main 8 9 // Need to compile package gob with debug.go to build this program. 10 // See comments in debug.go for how to do this. 11 12 import ( 13 "encoding/gob" 14 "fmt" 15 "os" 16 ) 17 18 func main() { 19 var err error 20 file := os.Stdin 21 if len(os.Args) > 1 { 22 file, err = os.Open(os.Args[1]) 23 if err != nil { 24 fmt.Fprintf(os.Stderr, "dump: %s\n", err) 25 os.Exit(1) 26 } 27 } 28 gob.Debug(file) 29 }