diff options
43 files changed, 1667 insertions, 358 deletions
@@ -1,29 +1,25 @@ -The MIT License (MIT) +The MIT License (Festival variant) -Copyright (c) 2020 Sean E. Russell <ser@ser1.net> 87651D71 +Permission is hereby granted, free of charge, to use and distribute this +software and its documentation without restriction, including without +limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of this work, and to permit persons to whom +this work is furnished to do so, subject to the following conditions: -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +1. The codemust retain the above copyright notice, this list of conditions + and the following disclaimer. +2. Any modifications must be clearly marked as such. +3. Original authors' names are not deleted. +4. The authors' names are not used to endorse or promote products derived + from this software without specific prior written permission. -1. Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. +THE COPYRIGHT HOLDERS AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS NOR THE +CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. -3. Neither the name of the copyright holder nor the names of its -contributors may be used to endorse or promote products derived from this -software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +https://fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#Festival_variant @@ -62,13 +62,21 @@ gotop should build with most versions of Go. If you have a version other than 1 git clone https://github.com/xxxserxxx/gotop.git cd gotop sed -i '/^go/d' go.mod # Do this if you have go != 1.14 -go build -o gotop ./cmd/gotop +VERS="$(git tag -l --sort=-v:refname | sed 's/v\([^-].*\)/\1/g' | head -1 | tr -d '-' ).$(git describe --long --tags | sed 's/\([^-].*\)-\([0-9]*\)-\(g.*\)/r\2.\3/g' | tr -d '-')" +DAT=$(date +%Y%m%dT%H%M%S) +go build -o gotop \ + -ldflags "-X main.Version=v${VERS} -X main.BuildDate=${DAT}" \ + ./cmd/gotop ``` Move `gotop` to somewhere in your `$PATH`. If Go is not installed or is the wrong version, and you don't have root access or don't want to upgrade Go, a script is provided to download Go and the gotop sources, compile gotop, and then clean up. See `scripts/install_without_root.sh`. +#### go generate + +Apple SMC tags are embedded in a text file that is compiled into the executable; the same happens with the language translations. When the file `devices/data/sm.tsv` or any translations in `translations/dicts/` change, `go generate` should be re-run. + ## Usage Run with `-h` to get an extensive list of command line arguments. Many of these can be configured by creating a configuration file; see the next section for more information. Key bindings can be viewed while gotop is running by pressing the `?` key, or they can be printed out by using the `--list keys` command. @@ -110,6 +118,7 @@ For more information on other topics, see: - [goreleaser/nfpm](https://github.com/goreleaser/nfpm) - [distatus/battery](https://github.com/distatus/battery) - [VictoriaMetrics/metrics](https://github.com/VictoriaMetrics/metrics) Check this out! The API is clean, elegant, introduces many fewer indirect dependencies than the Prometheus client, and adds 50% less size to binaries. +- [lingo-toml](https://github.com/jdkeke142/lingo-toml) provides the translation support library. ## History diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go index fd2dc81..3545470 100644 --- a/cmd/gotop/main.go +++ b/cmd/gotop/main.go @@ -5,6 +5,7 @@ import ( "flag" "fmt" "io" + "io/ioutil" "log" "net/http" "os" @@ -18,7 +19,9 @@ import ( //_ "net/http/pprof" "github.com/VictoriaMetrics/metrics" + jj "github.com/cloudfoundry-attic/jibber_jabber" ui "github.com/gizak/termui/v3" + "github.com/jdkeke142/lingo-toml" "github.com/shibukawa/configdir" "github.com/xxxserxxx/opflag" @@ -27,7 +30,7 @@ import ( "github.com/xxxserxxx/gotop/v4/devices" "github.com/xxxserxxx/gotop/v4/layout" "github.com/xxxserxxx/gotop/v4/logging" - "github.com/xxxserxxx/gotop/v4/widgets" + "github.com/xxxserxxx/gotop/v4/translations" w "github.com/xxxserxxx/gotop/v4/widgets" ) @@ -50,6 +53,7 @@ var ( bar *w.StatusBar statusbar bool stderrLogger = log.New(os.Stderr, "", 0) + tr lingo.Translations ) func parseArgs() error { @@ -58,33 +62,27 @@ func parseArgs() error { for i, p := range cds { cpaths[i] = p.Path } - help := opflag.BoolP("help", "h", false, "Show this screen.") - color := opflag.StringP("color", "c", conf.Colorscheme.Name, "Set a colorscheme.") - opflag.IntVarP(&conf.GraphHorizontalScale, "graphscale", "S", conf.GraphHorizontalScale, "Graph scale factor, >0") - version := opflag.BoolP("version", "v", false, "Print version and exit.") - versioN := opflag.BoolP("", "V", false, "Print version and exit.") - opflag.BoolVarP(&conf.PercpuLoad, "percpu", "p", conf.PercpuLoad, "Show each CPU in the CPU widget.") - opflag.BoolVarP(&conf.AverageLoad, "averagecpu", "a", conf.AverageLoad, "Show average CPU in the CPU widget.") - fahrenheit := opflag.BoolP("fahrenheit", "f", conf.TempScale == 'F', "Show temperatures in fahrenheit.") - opflag.BoolVarP(&conf.Statusbar, "statusbar", "s", conf.Statusbar, "Show a statusbar with the time.") - opflag.DurationVarP(&conf.UpdateInterval, "rate", "r", conf.UpdateInterval, "Refresh frequency. Most time units accepted. `1m` = refresh every minute. `100ms` = refresh every 100ms.") - opflag.StringVarP(&conf.Layout, "layout", "l", conf.Layout, `Name of layout spec file for the UI. Use "-" to pipe.`) - opflag.StringVarP(&conf.NetInterface, "interface", "i", "all", "Select network interface. Several interfaces can be defined using comma separated values. Interfaces can also be ignored using `!`") - opflag.StringVarP(&conf.ExportPort, "export", "x", conf.ExportPort, "Enable metrics for export on the specified port.") - opflag.BoolVarP(&conf.Mbps, "mbps", "", conf.Mbps, "Show network rate as mbps.") - opflag.BoolVar(&conf.Test, "test", conf.Test, "Runs tests and exits with success/failure code.") - opflag.StringP("", "C", "", "Config file to use instead of default (MUST BE FIRST ARGUMENT)") - list := opflag.String("list", "", `List <devices|layouts|colorschemes|paths|keys> - devices: Prints out device names for filterable widgets - layouts: Lists build-in layouts - colorschemes: Lists built-in colorschemes - paths: List out configuration file search paths - widgets: Widgets that can be used in a layout - keys: Show the keyboard bindings.`) - wc := opflag.Bool("write-config", false, "Write out a default config file.") + help := opflag.BoolP("help", "h", false, tr.Value("args.help")) + color := opflag.StringP("color", "c", conf.Colorscheme.Name, tr.Value("args.color")) + opflag.IntVarP(&conf.GraphHorizontalScale, "graphscale", "S", conf.GraphHorizontalScale, tr.Value("args.scale")) + version := opflag.BoolP("version", "v", false, tr.Value("args.version")) + versioN := opflag.BoolP("", "V", false, tr.Value("args.version")) + opflag.BoolVarP(&conf.PercpuLoad, "percpu", "p", conf.PercpuLoad, tr.Value("args.percpu")) + opflag.BoolVarP(&conf.AverageLoad, "averagecpu", "a", conf.AverageLoad, tr.Value("args.cpuavg")) + fahrenheit := opflag.BoolP("fahrenheit", "f", conf.TempScale == 'F', tr.Value("args.temp")) + opflag.BoolVarP(&conf.Statusbar, "statusbar", "s", conf.Statusbar, tr.Value("args.statusbar")) + opflag.DurationVarP(&conf.UpdateInterval, "rate", "r", conf.UpdateInterval, tr.Value("args.rate")) + opflag.StringVarP(&conf.Layout, "layout", "l", conf.Layout, tr.Value("args.layout")) + opflag.StringVarP(&conf.NetInterface, "interface", "i", "all", tr.Value("args.net")) + opflag.StringVarP(&conf.ExportPort, "export", "x", conf.ExportPort, tr.Value("args.export")) + opflag.BoolVarP(&conf.Mbps, "mbps", "", conf.Mbps, tr.Value("args.mbps")) + opflag.BoolVar(&conf.Test, "test", conf.Test, tr.Value("args.test")) + opflag.StringP("", "C", "", tr.Value("args.conffile")) + list := opflag.String("list", "", tr.Value("args.list")) + wc := opflag.Bool("write-config", false, tr.Value("args.write")) opflag.SortFlags = false opflag.Usage = func() { - fmt.Fprintf(os.Stderr, "Usage: %s [options]\n\nOptions:\n", os.Args[0]) + fmt.Fprintf(os.Stderr, tr.Value("usage", os.Args[0])) opflag.PrintDefaults() } opflag.Parse() @@ -109,25 +107,26 @@ func parseArgs() error { if *list != "" { switch *list { case "layouts": - fmt.Println(_layouts) + fmt.Println(tr.Value("help.layouts")) case "colorschemes": - fmt.Println(_colorschemes) + fmt.Println(tr.Value("help.colorschemes")) case "paths": - fmt.Println("Loadable colorschemes & layouts, and the config file, are searched for, in order:") + fmt.Println(tr.Value("help.paths")) paths := make([]string, 0) for _, d := range conf.ConfigDir.QueryFolders(configdir.All) { paths = append(paths, d.Path) } fmt.Println(strings.Join(paths, "\n")) - fmt.Printf("\nThe log file is in %s\n", filepath.Join(conf.ConfigDir.QueryCacheFolder().Path, logging.LOGFILE)) + fmt.Println() + fmt.Println(tr.Value("help.log", filepath.Join(conf.ConfigDir.QueryCacheFolder().Path, logging.LOGFILE))) case "devices": listDevices() case "keys": - fmt.Println(widgets.KEYBINDS) + fmt.Println(tr.Value("help.help")) case "widgets": - fmt.Println(_widgets) + fmt.Println(tr.Value("help.widgets")) default: - fmt.Printf("Unknown option \"%s\"; try layouts, colorschemes, keys, paths, or devices\n", *list) + fmt.Printf(tr.Value("error.unknownopt", *list)) os.Exit(1) } os.Exit(0) @@ -135,10 +134,10 @@ func parseArgs() error { if *wc { path, err := conf.Write() if err != nil { - fmt.Printf("Failed to write configuration file: %s\n", err) + fmt.Println(tr.Value("error.writefail", err.Error())) os.Exit(1) } - fmt.Printf("Config written to %s\n", path) + fmt.Println(tr.Value("help.written", path)) os.Exit(0) } return nil @@ -332,7 +331,6 @@ func eventLoop(c gotop.Config, grid *layout.MyGrid) { } } -// TODO: state:merge #135 linux console font (cmatsuoka/console-font) func main() { // TODO: Make this an option, for performance testing //go func() { @@ -346,38 +344,55 @@ func main() { ec := run() if ec > 0 { if ec < 2 { - fmt.Printf("errors encountered; check the log file %s\n", filepath.Join(conf.ConfigDir.QueryCacheFolder().Path, logging.LOGFILE)) + logpath := filepath.Join(conf.ConfigDir.QueryCacheFolder().Path, logging.LOGFILE) + fmt.Println(tr.Value("error.checklog", logpath)) + bs, _ := ioutil.ReadFile(logpath) + fmt.Println(string(bs)) } } os.Exit(ec) } func run() int { + ling, err := lingo.New("en_US", "translations", translations.AssetFile()) + if err != nil { + fmt.Printf("failed to load language files: %s\n", err) + return 2 + } + lang, err := jj.DetectIETF() + if err != nil { + lang = "en_US" + } + lang = strings.Replace(lang, "-", "_", -1) + // Get the locale from the os + tr = ling.TranslationsForLocale(lang) + colorschemes.SetTr(tr) conf = gotop.NewConfig() + conf.Tr = tr // Find the config file; look in (1) local, (2) user, (3) global // Check the last argument first fs := flag.NewFlagSet("config", flag.ContinueOnError) - cfg := fs.String("C", "", "Config file") + cfg := fs.String("C", "", tr.Value("configfile")) fs.SetOutput(bufio.NewWriter(nil)) fs.Parse(os.Args[1:]) if *cfg != "" { conf.ConfigFile = *cfg } - err := conf.Load() + err = conf.Load() if err != nil { - fmt.Printf("failed to parse config file: %s\n", err) + fmt.Println(tr.Value("error.configparse", err.Error())) return 2 } // Override with command line arguments err = parseArgs() if err != nil { - fmt.Printf("parsing CLI args: %s\n", err) + fmt.Println(tr.Value("error.cliparse", err.Error())) return 2 } logfile, err := logging.New(conf) if err != nil { - fmt.Printf("failed to setup log file: %v\n", err) + fmt.Println(tr.Value("logsetup", err.Error())) return 2 } defer logfile.Close() @@ -408,7 +423,7 @@ func run() int { defer ui.Close() setDefaultTermuiColors(conf) // done before initializing widgets to allow inheriting colors - help = w.NewHelpMenu() + help = w.NewHelpMenu(tr) if statusbar { bar = w.NewStatusBar() } @@ -468,7 +483,7 @@ func getLayout(conf gotop.Config) (io.Reader, error) { for _, d := range conf.ConfigDir.QueryFolders(configdir.Existing) { paths = append(paths, d.Path) } - return nil, fmt.Errorf("unable find layout file %s in %s", conf.Layout, strings.Join(paths, ", ")) + return nil, fmt.Errorf(tr.Value("error.findlayout", conf.Layout, strings.Join(paths, ", "))) } lo, err := folder.ReadFile(conf.Layout) if err != nil { @@ -493,26 +508,3 @@ func listDevices() { } } } - -const _layouts = `Built-in layouts: - default - minimal - battery - kitchensink` -const _colorschemes = `Built-in colorschemes: - default - default-dark (for white background) - solarized - solarized16-dark - solarized16-light - monokai - vice - nord` -const _widgets = `Widgets that can be used in layouts: - cpu - CPU load graph - mem - Physical & swap memory use graph - temp - Sensor temperatures - disk - Physical disk partition use - power - A battery bar - net - Network load - procs - Interactive process list` diff --git a/colorschemes/registry.go b/colorschemes/registry.go index baa4bda..84b2e89 100644 --- a/colorschemes/registry.go +++ b/colorschemes/registry.go @@ -6,6 +6,7 @@ import ( "path/filepath" "strings" + "github.com/jdkeke142/lingo-toml" "github.com/shibukawa/configdir" ) @@ -17,6 +18,13 @@ func init() { } } +var tr lingo.Translations + +// Set the translation library +func SetTr(tra lingo.Translations) { + tr = tra +} + // FromName loads a Colorscheme by name; confDir is used to search // directories for a scheme matching the name. The search order // is the same as for config files. @@ -46,15 +54,15 @@ func getCustomColorscheme(confDir configdir.ConfigDir, name string) (Colorscheme for _, d := range confDir.QueryFolders(configdir.Existing) { paths = append(paths, d.Path) } - return cs, fmt.Errorf("failed to find colorscheme file %s in %s", fn, strings.Join(paths, ", ")) + return cs, fmt.Errorf(tr.Value("error.colorschemefile", fn, strings.Join(paths, ", "))) } dat, err := folder.ReadFile(fn) if err != nil { - return cs, fmt.Errorf("failed to read colorscheme file %s: %v", filepath.Join(folder.Path, fn), err) + return cs, fmt.Errorf(tr.Value("error.colorschemeload", filepath.Join(folder.Path, fn), err.Error())) } err = json.Unmarshal(dat, &cs) if err != nil { - return cs, fmt.Errorf("failed to parse colorscheme file: %v", err) + return cs, fmt.Errorf(tr.Value("error.colorschemeparse", err.Error())) } return cs, nil } @@ -1,5 +1,8 @@ package gotop +//go:generate go-bindata -fs -pkg translations -prefix translations -o translations/dicts.go translations/dicts +//go:generate go-bindata -pkg devices -prefix devices/data -o devices/smc.go devices/data + import ( "bufio" "bytes" @@ -13,6 +16,7 @@ import ( "strings" "time" + "github.com/jdkeke142/lingo-toml" "github.com/shibukawa/configdir" "github.com/xxxserxxx/gotop/v4/colorschemes" "github.com/xxxserxxx/gotop/v4/widgets" @@ -40,6 +44,7 @@ type Config struct { Test bool ExtensionVars map[string]string ConfigFile string + Tr lingo.Translations } func NewConfig() Config { @@ -97,18 +102,15 @@ func load(in io.Reader, conf *Config) error { } kv := strings.Split(l, "=") if len(kv) != 2 { - return fmt.Errorf("bad config file syntax; should be KEY=VALUE, was %s", l) + return fmt.Errorf(conf.Tr.Value("config.err.configsyntax", l)) } key := strings.ToLower(kv[0]) + ln := strconv.Itoa(lineNo) switch key { default: conf.ExtensionVars[key] = kv[1] - case "configdir": - log.Printf("configdir is deprecated. Ignored configdir=%s", kv[1]) - case "logdir": - log.Printf("logdir is deprecated. Ignored logdir=%s", kv[1]) - case "logfile": - log.Printf("logfile is deprecated. Ignored logfile=%s", kv[1]) + case "configdir", "logdir", "logfile": + log.Printf(conf.Tr.Value("config.err.deprecation", ln, key, kv[1])) case graphhorizontalscale: iv, err := strconv.Atoi(kv[1]) if err != nil { @@ -118,31 +120,31 @@ func load(in io.Reader, conf *Config) error { case helpvisible: bv, err := strconv.ParseBool(kv[1]) if err != nil { - return fmt.Errorf("line %d: %v", lineNo, err) + return fmt.Errorf(conf.Tr.Value("config.err.line", ln, err.Error())) } conf.HelpVisible = bv case colorscheme: cs, err := colorschemes.FromName(conf.ConfigDir, kv[1]) if err != nil { - return fmt.Errorf("line %d: %v", lineNo, err) + return fmt.Errorf(conf.Tr.Value("config.err.line", ln, err.Error())) } conf.Colorscheme = cs case updateinterval: iv, err := strconv.Atoi(kv[1]) if err != nil { - return err + return fmt.Errorf(conf.Tr.Value("config.err.line", ln, err.Error())) } conf.UpdateInterval = time.Duration(iv) case averagecpu: bv, err := strconv.ParseBool(kv[1]) if err != nil { - return fmt.Errorf("line %d: %v", lineNo, err) + return fmt.Errorf(conf.Tr.Value("config.err.line", ln, err.Error())) } conf.AverageLoad = bv case percpuload: bv, err := strconv.ParseBool(kv[1]) if err != nil { - return fmt.Errorf("line %d: %v", lineNo, err) + return fmt.Errorf(conf.Tr.Value("config.err.line", ln, err.Error())) } conf.PercpuLoad = bv case tempscale: @@ -153,12 +155,12 @@ func load(in io.Reader, conf *Config) error { conf.TempScale = 'F' default: conf.TempScale = 'C' - return fmt.Errorf("invalid TempScale value %s", kv[1]) + return fmt.Errorf(conf.Tr.Value("config.err.tempscale", kv[1])) } case statusbar: bv, err := strconv.ParseBool(kv[1]) if err != nil { - return fmt.Errorf("line %d: %v", lineNo, err) + return fmt.Errorf(conf.Tr.Value("config.err.line", ln, err.Error())) } conf.Statusbar = bv case netinterface: @@ -168,7 +170,7 @@ func load(in io.Reader, conf *Config) error { case maxlogsize: iv, err := strconv.Atoi(kv[1]) if err != nil { - return err + return fmt.Errorf(conf.Tr.Value("config.err.line", ln, err.Error())) } conf.MaxLogSize = int64(iv) case export: diff --git a/config_test.go b/config_test.go index 4afb44d..1f4ecb0 100644 --- a/config_test.go +++ b/config_test.go @@ -9,7 +9,6 @@ import ( "github.com/xxxserxxx/gotop/v4/widgets" ) -// FIXME This is totally broken since the updates func TestParse(t *testing.T) { tests := []struct { i string diff --git a/devices/cpu_cpu.go b/devices/cpu_cpu.go index 0c1f9c1..9847572 100644 --- a/devices/cpu_cpu.go +++ b/devices/cpu_cpu.go @@ -6,10 +6,9 @@ import ( psCpu "github.com/shirou/gopsutil/cpu" ) -// FIXME: broken % under Linux. Doesn't reflect reality *at all*. func init() { f := func(cpus map[string]int, l bool) map[string]error { - cpuCount, err := psCpu.Counts(l) + cpuCount, err := CpuCount() if err != nil { return nil } diff --git a/devices/cpu_linux.go b/devices/cpu_linux.go new file mode 100644 index 0000000..4e836d5 --- /dev/null +++ b/devices/cpu_linux.go @@ -0,0 +1,23 @@ +// +build linux + +package devices + +import "github.com/shirou/gopsutil/cpu" + +func CpuCount() (int, error) { + cpuCount, err := cpu.Counts(false) + if err != nil { + return 0, err + } + if cpuCount == 0 { + is, err := cpu.Info() + if err != nil { + return 0, err + } + if is[0].Cores > 0 { + return len(is) / 2, nil + } + return len(is), nil + } + return cpuCount, nil +} diff --git a/devices/cpu_other.go b/devices/cpu_other.go new file mode 100644 index 0000000..95d183f --- /dev/null +++ b/devices/cpu_other.go @@ -0,0 +1,9 @@ +// +build !linux + +package devices + +import "github.com/shirou/gopsutil/cpu" + +func CpuCount() (int, error) { + return cpu.Counts(false) +} diff --git a/devices/devices.go b/devices/devices.go index 7360578..8873ae5 100644 --- a/devices/devices.go +++ b/devices/devices.go @@ -2,6 +2,7 @@ package devices import ( "log" + "github.com/jdkeke142/lingo-toml" ) const ( @@ -15,6 +16,7 @@ var _shutdownFuncs []func() error var _devs map[string][]string var _defaults map[string][]string var _startup []func(map[string]string) error +var tr lingo.Translations // RegisterShutdown stores a function to be called by gotop on exit, allowing // extensions to properly release resources. Extensions should register a @@ -86,3 +88,7 @@ func Devices(domain string, all bool) []string { } return _defaults[domain] } + +func SetTr(tra lingo.Translations) { + tr = tra +} diff --git a/devices/smc.go b/devices/smc.go index 4701a07..dfcd1ac 100644 --- a/devices/smc.go +++ b/devices/smc.go @@ -1,8 +1,7 @@ -// Code generated by go-bindata. -// sources: -// data/smc.tsv -// DO NOT EDIT! +// Code generated by go-bindata. (@generated) DO NOT EDIT. + //Package devices generated by go-bindata.// sources: +// devices/data/smc.tsv package devices import ( @@ -20,7 +19,7 @@ import ( func bindataRead(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) + return nil, fmt.Errorf("read %q: %v", name, err) } var buf bytes.Buffer @@ -28,7 +27,7 @@ func bindataRead(data []byte, name string) ([]byte, error) { clErr := gz.Close() if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) + return nil, fmt.Errorf("read %q: %v", name, err) } if clErr != nil { return nil, err @@ -49,21 +48,32 @@ type bindataFileInfo struct { modTime time.Time } +// Name return file name func (fi bindataFileInfo) Name() string { return fi.name } + +// Size return file size func (fi bindataFileInfo) Size() int64 { return fi.size } + +// Mode return file mode func (fi bindataFileInfo) Mode() os.FileMode { return fi.mode } + +// ModTime return file modify time func (fi bindataFileInfo) ModTime() time.Time { return fi.modTime } + +// IsDir return file whether a directory func (fi bindataFileInfo) IsDir() bool { - |