aboutsummaryrefslogtreecommitdiffstats
path: root/compressor
diff options
context:
space:
mode:
Diffstat (limited to 'compressor')
-rw-r--r--compressor/compressor.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/compressor/compressor.go b/compressor/compressor.go
index efe792e..0b9af90 100644
--- a/compressor/compressor.go
+++ b/compressor/compressor.go
@@ -1,12 +1,13 @@
package compressor
import (
+ "fmt"
"github.com/BurntSushi/toml"
"io/fs"
+ "os"
fp "path/filepath"
"github.com/sam-anthony/volute/mass"
- "github.com/sam-anthony/volute/util"
)
const root = "compressor/res/"
@@ -32,7 +33,7 @@ type Compressor struct {
}
// [manufacturer][series][model]
-var compressors = make(map[string]map[string]map[string]Compressor)
+var Compressors = make(map[string]map[string]map[string]Compressor)
func init() {
// Walk root, looking for .toml files describing a compressor.
@@ -57,13 +58,13 @@ func init() {
man = fp.Clean(man) // Clean trailing slash
var exists bool
- _, exists = compressors[man]
+ _, exists = Compressors[man]
if !exists {
- compressors[man] = make(map[string]map[string]Compressor)
+ Compressors[man] = make(map[string]map[string]Compressor)
}
- _, exists = compressors[man][ser]
+ _, exists = Compressors[man][ser]
if !exists {
- compressors[man][ser] = make(map[string]Compressor)
+ Compressors[man][ser] = make(map[string]Compressor)
}
tomlFile := fp.Join(root, path)
@@ -95,13 +96,12 @@ func init() {
}
c.MaxFlow = mass.FlowRate(flow.FlowVal) * u
- compressors[man][ser][mod] = c
+ Compressors[man][ser][mod] = c
return nil
})
- util.Check(err)
-}
-
-func Compressors() map[string]map[string]map[string]Compressor {
- return compressors
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
}