MCPcopy
hub / github.com/syncthing/syncthing / writeCompatJSON

Function writeCompatJSON

build.go:1409–1433  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1407}
1408
1409func writeCompatJSON() {
1410 bs, err := os.ReadFile("compat.yaml")
1411 if err != nil {
1412 log.Fatal("Reading compat.yaml:", err)
1413 }
1414
1415 var entries []upgrade.ReleaseCompatibility
1416 if err := yaml.Unmarshal(bs, &entries); err != nil {
1417 log.Fatal("Parsing compat.yaml:", err)
1418 }
1419
1420 rt := runtime.Version()
1421 for _, e := range entries {
1422 if !strings.HasPrefix(rt, e.Runtime) {
1423 continue
1424 }
1425 bs, _ := json.MarshalIndent(e, "", " ")
1426 if err := os.WriteFile("compat.json", bs, 0o644); err != nil {
1427 log.Fatal("Writing compat.json:", err)
1428 }
1429 return
1430 }
1431
1432 log.Fatalf("runtime %v not found in compat.yaml", rt)
1433}

Callers 1

runCommandFunction · 0.85

Calls 2

FatalMethod · 0.80
UnmarshalMethod · 0.45

Tested by

no test coverage detected