"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "go/pkg/format/format-netspoc.go" between
Netspoc-6.025.tar.gz and Netspoc-6.026.tar.gz

About: NetSPoC is a network security policy compiler (using its own description language) to manage all the packet filter devices inside your network topology.

format-netspoc.go  (Netspoc-6.025):format-netspoc.go  (Netspoc-6.026)
package format package format
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/hknutzen/Netspoc/go/pkg/conf" "github.com/hknutzen/Netspoc/go/pkg/conf"
"github.com/hknutzen/Netspoc/go/pkg/diag"
"github.com/hknutzen/Netspoc/go/pkg/fileop" "github.com/hknutzen/Netspoc/go/pkg/fileop"
"github.com/hknutzen/Netspoc/go/pkg/filetree" "github.com/hknutzen/Netspoc/go/pkg/filetree"
"github.com/hknutzen/Netspoc/go/pkg/info"
"github.com/hknutzen/Netspoc/go/pkg/parser" "github.com/hknutzen/Netspoc/go/pkg/parser"
"github.com/hknutzen/Netspoc/go/pkg/printer" "github.com/hknutzen/Netspoc/go/pkg/printer"
"github.com/spf13/pflag" "github.com/spf13/pflag"
"os" "os"
) )
func processInput(input *filetree.Context) error { func processInput(input *filetree.Context) error {
source := []byte(input.Data) source := []byte(input.Data)
path := input.Path path := input.Path
list, err := parser.ParseFile(source, path) list, err := parser.ParseFile(source, path)
skipping to change at line 31 skipping to change at line 31
return err return err
} }
for _, n := range list { for _, n := range list {
n.Order() n.Order()
} }
copy := printer.File(list, source) copy := printer.File(list, source)
if bytes.Compare(source, copy) == 0 { if bytes.Compare(source, copy) == 0 {
return nil return nil
} }
diag.Info("Changed %s", path) info.Msg("Changed %s", path)
return fileop.Overwrite(path, copy) return fileop.Overwrite(path, copy)
} }
func Main() int { func Main() int {
fs := pflag.NewFlagSet(os.Args[0], pflag.ContinueOnError) fs := pflag.NewFlagSet(os.Args[0], pflag.ContinueOnError)
// Setup custom usage function. // Setup custom usage function.
fs.Usage = func() { fs.Usage = func() {
fmt.Fprintf(os.Stderr, fmt.Fprintf(os.Stderr,
 End of changes. 3 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)