Skip to content

gofika/gobutil

Repository files navigation

codecov Build Status go.dev Go Report Card Licenses

gobutil

golang gob utils for common use

Basic Usage

Installation

To get the package, execute:

go get github.com/gofika/gobutil

Example

package main

import (
	"fmt"

	"github.com/gofika/gobutil"
)

func main() {
	type Foo struct {
		Name  string
		Value int
	}
	type Bar struct {
		Name  string
		Value int
	}
	foo := &Foo{"Jason", 100}
	// deep copy for different struct
	bar, err := gobutil.DeepCopy[Bar](foo)
	if err != nil {
		fmt.Printf("DeepCopy failed. err: %s\n", err.Error())
		return
	}
	fmt.Printf("bar.Name: %s\n", bar.Name)
	fmt.Printf("bar.Value: %d\n", bar.Value)
}

About

golang gob utils for common use

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages