package config // functions to import and export the protobuf // data to and from config files /* func (e *Events) Save() { var fullname string base, _ := filepath.Split(argv.Config) fullname = filepath.Join(base, "events.pb") data, err := e.Marshal() if err != nil { log.Info("proto.Marshal() failed", err) return } log.Info("proto.Marshal() worked len", len(data)) configWrite(fullname, data) } func configWrite(fullname string, data []byte) error { if _, base := filepath.Split(fullname); base == "" { return fmt.Errorf("--config option not set") } cfgfile, err := os.OpenFile(fullname, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) defer cfgfile.Close() if err != nil { log.Warn("open config file :", err) return err } cfgfile.Write(data) return nil } func (m *Portmaps) configWrite(fullname string, data []byte) error { if _, base := filepath.Split(fullname); base == "" { return fmt.Errorf("--config option not set") } cfgfile, err := os.OpenFile(fullname, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) defer cfgfile.Close() if err != nil { log.Warn("open config file :", err) return err } cfgfile.Write(data) return nil } */