Documentation
¶
Overview ¶
Package gomerge provides means to merge two go files removing duplicate imports.
Example ¶
package main
import (
"os"
"github.com/gregoryv/gomerge"
)
func main() {
cmd := gomerge.New(os.Stdout,
[]byte(`package x
import "fmt"
func x() { fmt.Println("hello") }`),
[]byte(`package x
import "strings"
func y() { strings.Repeat(" ", 10) }`),
)
cmd.SetSrcFile("mytest.go")
cmd.SetIncludeFile(true)
cmd.Run()
}
Output: package x import ( "fmt" "strings" ) func x() { fmt.Println("hello") } // gomerge src: mytest.go func y() { strings.Repeat(" ", 10) }
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GoMerge ¶
type GoMerge struct {
// contains filtered or unexported fields
}
func (*GoMerge) SetIncludeFile ¶
func (*GoMerge) SetSrcFile ¶
type GoSrc ¶
type GoSrc struct {
Header string // docs before package
Package string // package
Imports string // imports
Rest string // rest of the content
}
Click to show internal directories.
Click to hide internal directories.