1- // SPDX-FileCopyrightText: 2024 OOMOL, Inc. <https://www.oomol.com>
1+ // SPDX-FileCopyrightText: 2024-2025 OOMOL, Inc. <https://www.oomol.com>
22// SPDX-License-Identifier: MPL-2.0
33
44package update
@@ -49,22 +49,22 @@ func (c *Context) needUpdate() (result []types.VersionKey) {
4949 jsonVersion := & types.Version {}
5050 data , err := os .ReadFile (c .jsonPath )
5151 if err != nil {
52- log .Warnf ("failed to read versions.json file: %v" , err )
52+ log .Warnf ("Failed to read versions.json file: %v" , err )
5353 return []types.VersionKey {types .VersionRootFS , types .VersionData }
5454 }
5555
5656 if err := json .Unmarshal (data , jsonVersion ); err != nil {
57- log .Warnf ("failed to unmarshal versions.json file, json content: %s, %v" , data , err )
57+ log .Warnf ("Failed to unmarshal versions.json file, json content: %s, %v" , data , err )
5858 _ = os .RemoveAll (c .jsonPath )
5959 return []types.VersionKey {types .VersionRootFS , types .VersionData }
6060 }
6161
6262 rootfsPath := filepath .Join (c .ImageDir , "ext4.vhdx" )
6363 if jsonVersion .RootFS != c .RootFS || util .Exists (rootfsPath ) != nil {
6464 if jsonVersion .RootFS != c .RootFS {
65- log .Infof ("need update rootfs, because version changed: %s -> %s" , jsonVersion .RootFS , c .RootFS )
65+ log .Infof ("Need update rootfs, because version changed: %s -> %s" , jsonVersion .RootFS , c .RootFS )
6666 } else {
67- log .Infof ("need update rootfs, because rootfs not exists: %s" , rootfsPath )
67+ log .Infof ("Need update rootfs, because rootfs not exists: %s" , rootfsPath )
6868 }
6969
7070 result = append (result , types .VersionRootFS )
@@ -73,9 +73,9 @@ func (c *Context) needUpdate() (result []types.VersionKey) {
7373 dataPath := filepath .Join (c .ImageDir , "data.vhdx" )
7474 if jsonVersion .Data != c .Data || util .Exists (dataPath ) != nil {
7575 if jsonVersion .Data != c .Data {
76- log .Infof ("need update data, because version changed: %s -> %s" , jsonVersion .Data , c .Data )
76+ log .Infof ("Need update data, because version changed: %s -> %s" , jsonVersion .Data , c .Data )
7777 } else {
78- log .Infof ("need update data, because data not exists: %s" , dataPath )
78+ log .Infof ("Need update data, because data not exists: %s" , dataPath )
7979 }
8080 result = append (result , types .VersionData )
8181 }
@@ -87,7 +87,7 @@ func (c *Context) CheckAndReplace() error {
8787 log := c .Logger
8888 list := c .needUpdate ()
8989 if len (list ) == 0 {
90- log .Info ("no need to update versions" )
90+ log .Info ("No need to update versions" )
9191 return nil
9292 }
9393
@@ -98,7 +98,7 @@ func (c *Context) CheckAndReplace() error {
9898 return fmt .Errorf ("failed to update data: %w" , err )
9999 }
100100 event .NotifyRun (event .UpdateDataSuccess )
101- log .Info ("update data success" )
101+ log .Info ("Update data success" )
102102 }
103103
104104 if slices .Contains (list , types .VersionRootFS ) {
@@ -108,7 +108,7 @@ func (c *Context) CheckAndReplace() error {
108108 return fmt .Errorf ("failed to update rootfs: %w" , err )
109109 }
110110 event .NotifyRun (event .UpdateRootFSSuccess )
111- log .Info ("update rootfs success" )
111+ log .Info ("Update rootfs success" )
112112 }
113113
114114 if err := c .save (); err != nil {
0 commit comments