Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
pivilartisant committed Dec 3, 2024
1 parent 77bae7b commit 76de6d8
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions api/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ func TopMiddleware(handler http.Handler) http.Handler {
//nolint:varnamelen
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
logger.Infof("[%s %s]", r.Method, r.URL.Path)

if configDir == "" {
var err error

configDir, err = configuration.Path()
if err != nil {
logger.Warnf("TLS: unable to get CA root path: %s", err)
Expand Down
1 change: 1 addition & 0 deletions cmd/massastation/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func main() {
})
stationGUI.Lifecycle().SetOnStarted(func() {
server.Start(networkManager, pluginManager)

err := pluginManager.RunAll()
if err != nil {
logger.Fatalf("while running all plugins: %w", err)
Expand Down
1 change: 1 addition & 0 deletions int/api/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func MassaStationWebAppHandler(params operations.MassaStationWebAppParams) middl
resourceContent, err := contentReact.ReadFile(basePathReact + "massastation/" + resourceName)
if err != nil {
resourceName = "index.html"

resourceContent, err = contentReact.ReadFile(basePathReact + "massastation/" + resourceName)
if err != nil {
return operations.NewMassaStationWebAppNotFound()
Expand Down
2 changes: 2 additions & 0 deletions int/api/massa/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ func TestNodeStatus(t *testing.T) {
response := getNodeHandler.Handle(operations.NewGetNodeParams())
responseTypes, ok := response.(*operations.GetNodeOK)
assert.True(t, ok, "responsePayload is not of type *operations.GetNodeOK")

responsePayload := responseTypes.Payload

assert.Equal(t, config.Network, *responsePayload.Network)
assert.Equal(t, config.ChainID, uint64(responsePayload.ChainID))
assert.Equal(t, config.NodeURL, *responsePayload.URL)
Expand Down
1 change: 1 addition & 0 deletions int/systray/update/update_dialog.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func createUpdateDialog(window fyne.Window, app *fyne.App) dialog.Dialog {
widget.NewLabel("If you choose to update, MassaStation will be closed and every running task will be stopped."),
func(b bool) {
window.Close()

if b {
utils.OpenURL(app, downloadURL)
(*app).Quit()
Expand Down
1 change: 1 addition & 0 deletions pkg/node/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func Addresses(client *Client, addr []string) ([]Address, error) {
}

var content []Address

err = response.GetObject(&content)
if err != nil {
return nil, fmt.Errorf("parsing get_addresses jsonrpc response '%+v': %w", response, err)
Expand Down
1 change: 1 addition & 0 deletions pkg/node/sendoperation/signer/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func (s *WalletPlugin) Sign(nickname string, operation []byte) (*SignOperationRe
}

res := SignOperationResponse{"", "", "", ""}

err = json.Unmarshal(httpRawResponse, &res)
if err != nil {
return nil, fmt.Errorf("unmarshalling '%s' JSON: %w", res, err)
Expand Down
5 changes: 2 additions & 3 deletions pkg/onchain/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ type datastoreEntry struct {
}

/*
*
populateDatastore creates and serializes a datastore for the given contract.
creates and serializes a datastore for the given contract.
*/
func populateDatastore(contract ContractDatastore) ([]byte, error) {
var datastore []datastoreEntry
Expand All @@ -35,7 +34,7 @@ func populateDatastore(contract ContractDatastore) ([]byte, error) {
datastore = append(datastore, datastoreEntry{Key: contractKey, Value: contract.Data})

// args data

// hardcoded for now, could be dynamix see: https://github.com/massalabs/massa-web3/blob/main/src/dataStore.ts
argsKey := []byte{1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}
datastore = append(datastore, datastoreEntry{Key: argsKey, Value: contract.Args})
Expand Down
4 changes: 4 additions & 0 deletions pkg/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ type prefixWriter struct {

func (pw prefixWriter) Write(buf []byte) (n int, err error) {
data := []byte(pw.prefix + string(buf))

n, err = pw.w.Write(data)
if err != nil {
return n, fmt.Errorf("writing logs with prefix: %w", err)
Expand Down Expand Up @@ -223,6 +224,7 @@ func (p *Plugin) binPath() string {

// Check if the MacOS .app directory exists.
macOSAppDirPath := filepath.Join(p.Path, pluginName+dotApp)

if _, err := os.Stat(macOSAppDirPath); os.IsNotExist(err) {
// Return the binary if not.
return utils.PluginPath(p.Path, pluginName)
Expand Down Expand Up @@ -269,6 +271,7 @@ func (p *Plugin) Start() error {
logger.Infof("plugin '%s' exit message: %s\n", pluginName, err.Error())

var exitErr *exec.ExitError

if errors.As(err, &exitErr) {
exitCode := exitErr.ExitCode()

Expand All @@ -294,6 +297,7 @@ func (p *Plugin) Stop() error {
logger.Infof("Stopping plugin %s.\n", p.ID)

status := p.Status()

if status != Up && status != Crashed {
return fmt.Errorf("plugin is not running")
}
Expand Down

0 comments on commit 76de6d8

Please sign in to comment.