Black Lives Matter. Support the Equal Justice Initiative.

Source file src/encoding/gob/dump.go

Documentation: encoding/gob

     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  // +build ignore
     7  
     8  package main
     9  
    10  // Need to compile package gob with debug.go to build this program.
    11  // See comments in debug.go for how to do this.
    12  
    13  import (
    14  	"encoding/gob"
    15  	"fmt"
    16  	"os"
    17  )
    18  
    19  func main() {
    20  	var err error
    21  	file := os.Stdin
    22  	if len(os.Args) > 1 {
    23  		file, err = os.Open(os.Args[1])
    24  		if err != nil {
    25  			fmt.Fprintf(os.Stderr, "dump: %s\n", err)
    26  			os.Exit(1)
    27  		}
    28  	}
    29  	gob.Debug(file)
    30  }
    31  

View as plain text