Source file src/encoding/gob/dump.go

     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  //go: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  }
    30  

View as plain text