lib/ur: Normalise contract between syncthing and ursrv (#6770)

* Fix ui, hide report date

* Undo Goland madness

* UR now web scale

* Fix migration

* Fix marshaling, force tick on start

* Fix tests

* Darwin build

* Split "all" build target, add package name as a tag

* Remove pq and sql dep from syncthing, split build targets

* Empty line

* Revert "Empty line"

This reverts commit f74af2b067.

* Revert "Remove pq and sql dep from syncthing, split build targets"

This reverts commit 8fc295ad00.

* Revert "Split "all" build target, add package name as a tag"

This reverts commit f4dc889951.

* Normalise contract types

* Fix build add more logging
This commit is contained in:
Audrius Butkevicius
2020-06-23 09:47:15 +01:00
committed by GitHub
parent 72f954dcab
commit 689cf2a5ee
18 changed files with 976 additions and 855 deletions
+6 -7
View File
@@ -8,32 +8,31 @@ package ur
import (
"bufio"
"errors"
"os"
"strconv"
"strings"
)
func memorySize() (int64, error) {
func memorySize() int64 {
f, err := os.Open("/proc/meminfo")
if err != nil {
return 0, err
return 0
}
s := bufio.NewScanner(f)
if !s.Scan() {
return 0, errors.New("/proc/meminfo parse error 1")
return 0
}
l := s.Text()
fs := strings.Fields(l)
if len(fs) != 3 || fs[2] != "kB" {
return 0, errors.New("/proc/meminfo parse error 2")
return 0
}
kb, err := strconv.ParseInt(fs[1], 10, 64)
if err != nil {
return 0, err
return 0
}
return kb * 1024, nil
return kb * 1024
}