Skip to content

Commit

Permalink
reset back to v1
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronSaikovski committed Jan 22, 2024
1 parent 28dcbce commit 3e8e8b4
Show file tree
Hide file tree
Showing 29 changed files with 382 additions and 473 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,3 @@ bin/
output*.*
out*.*
out.txt

.idea/
3 changes: 1 addition & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ builds:
goos:
- linux
- windows
- darwin
main: ./cmd/gogoodwe
- darwin

archives:
- format: tar.gz
Expand Down
19 changes: 1 addition & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
# GoGoodwe - CHANGELOG

## v2.0.0 (2024-01-22)

- Major refactoring to cleanup project structure
- Simplified package structure

## v1.4.0 (2023-08-30)

- Major refactoring to move non-shared code to /internal folder
- Abstracted core away from main()

## v1.1.0 (2023-08-16)

- refactored code to make errors bubble back to main package and better error reporting/logging
- refactored main package to include run() method
- removed staticcheck as there is a bug with Go v1.21
# CHANGELOG

## v1.0.0 (2023-08-10)

- initial version 1.0 release
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024, Aaron Saikovski
Copyright (c) 2023, Aaron Saikovski

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
79 changes: 28 additions & 51 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,91 +1,68 @@
# Define Go command and flags
GO = go
GOFLAGS = -ldflags="-s -w"
TARGET = gogoodwe
MAINAPPPATH = ./main.go

default: help
#export PATH=$PATH:$HOME/go/bin;

# Define the target executable
TARGET = gogoodwe

.PHONY: help
## help - Display help about make targets for this Makefile
help:
@cat Makefile | grep '^## ' --color=never | cut -c4- | sed -e "`printf 's/ - /\t- /;'`" | column -s "`printf '\t'`" -t


.PHONY: release
## release - Builds the project in preparation for (local)release
release: vet lint seccheck
go build $(GOFLAGS) -o bin/${TARGET} ${MAINAPPPATH}
## localrelease - Builds the project in preparation for (local)release
localrelease:
go build $(GOFLAGS) -o bin/${TARGET} main.go
file bin/${TARGET}


.PHONY: goreleaser
## goreleaser - Builds the project in preparation for release
goreleaser:
goreleaser release --snapshot --clean


.PHONY: docs
## docs - updates the swagger docs
docs:
swag init


.PHONY: build
## build - Builds the project in preparation for debug
## release - Builds the project in preparation for release
release:
goreleaser release --snapshot --clean

## debug - Builds the project in preparation for debug
build:
go build -o bin/${TARGET} ${MAINAPPPATH}
go build -o bin/${TARGET} main.go
file bin/${TARGET}

## buildandrun - builds and runs the program on the target platform
buildandrun: build
./bin/${TARGET}

.PHONY: run
## run - builds and runs the program on the target platform
run:
go run ${MAINAPPPATH}
## run - runs main.go for testing
run: dep
go run main.go


.PHONY: clean
## clean - Remove the old builds and any debug information
clean:
go clean
rm -rf dist
rm bin/${TARGET}


.PHONY: test
## test - executes unit tests
## test - executes unit test
test:
go test -v ./test/...
go test ./...


.PHONY: deps
## deps - fetches any external dependencies and updates
deps:
## dep - fetches any external dependencies
dep:
go mod tidy
go mod download
go get -u ./...


.PHONY: vet
## vet - Vet examines Go source code and reports suspicious constructs
vet:
go vet ./...

## staticcheck - Runs static code analyzer staticcheck
staticcheck:
go run honnef.co/go/tools/cmd/staticcheck@latest -checks=all,-ST1000,-U1000 ./...

.PHONY: staticcheck
## staticcheck - Runs static code analyzer staticcheck - currently broken
staticcheck:
staticcheck ./...


.PHONY: seccheck
## seccheck - Code vulnerability check
seccheck:
brew install govulncheck
govulncheck ./...


.PHONY: lint
## lint - format code and tidy modules
lint:
go fmt ./...
go mod tidy -v
go mod tidy -v
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<div align="center">

# GoGoodwe
# GoGgoodwe

A command line tool and query the GOODWE SEMS Inverter APIs - written in 100% Go.
A command line tool and Go packages to query the GOODWE SEMS Portal APIs - written in 100% Go.

[![Build Status](https://github.com/AaronSaikovski/gogoodwe/workflows/build/badge.svg)](https://github.com/AaronSaikovski/gogoodwe/actions)
[![Coverage Status](https://coveralls.io/repos/github/AaronSaikovski/gogoodwe/badge.svg?branch=main)](https://coveralls.io/github/AaronSaikovski/gogoodwe?branch=main)
[![Licence](https://img.shields.io/github/license/AaronSaikovski/gogoodwe)](LICENSE)

</div>
Expand All @@ -14,19 +15,17 @@ A command line tool and query the GOODWE SEMS Inverter APIs - written in 100% Go
The toolchain is mainly driven by the Makefile.

```bash
help - Display help about make targets for this Makefile
release - Builds the project in preparation for (local)release
goreleaser - Builds the project in preparation for release
docs - updates the swagger docs
build - Builds the project in preparation for debug
run - builds and runs the program on the target platform
clean - Remove the old builds and any debug information
test - executes unit tests
deps - fetches any external dependencies and updates
vet - Vet examines Go source code and reports suspicious constructs
staticcheck - Runs static code analyzer staticcheck - currently broken
seccheck - Code vulnerability check
lint - format code and tidy modules
* help - Display help about make targets for this Makefile
* release - Builds the project in preparation for release
* debug - Builds the project in preparation for debug
* buildandrun - builds and runs the program on the target platform
* run - runs main.go for testing
* clean - Remove the old builds and any debug information
* test - executes unit test
* dep - fetches any external dependencies
* vet - Vet examines Go source code and reports suspicious constructs
* staticcheck - Runs static code analyzer staticcheck
* lint - format code and tidy modules
```

To get started type,
Expand Down
23 changes: 7 additions & 16 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
# GoGoodwe V2 - TODO
# gogoodwe TODO

### ToDo
GoGoodwe backlog

- [ ] Add ability to output inverter data to a file.
- [ ] Format the inverter output to make it more human readable.
- [ ] Add the ability to query historical data for a single day.
- [ ] Have the ability to have a realtime logging to the screen or to a file in 5 minute intervals.
- [ ] Add the ability to produce a daily summary of key data (Generation today, Income today, total generation, total income).
- [ ] Add the ability to query the inverter status for Generation today and Status (check if operational).
- [ ] Add goroutines and wait groups for the API calls and maybe channels for success/failed API calls.
- [ ] Add Cobra for command flag parsing and processing.
- [ ] Investigate the ability to generate .CSV files as output.
- [ ]
### Todo

### In Progress
- [ ] Add ability to output to file with a flag
- [ ] Add ability to have a smaller output struct of just key reporting data
- [ ] Add Golang contexts for API calls

- [ ] add unit tests
### In Progress

### Done ✓

- [ ]
29 changes: 0 additions & 29 deletions app/app.go

This file was deleted.

9 changes: 2 additions & 7 deletions constants/constants.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
/*
# Name: constants - shared constants
# Author: Aaron Saikovski - [email protected]
*/

package constants

const (
// Auth Login Url
AuthLoginUrl string = "https://www.semsportal.com/api/v2/Common/CrossLogin"
AuthLoginUrL string = "https://www.semsportal.com/api/v2/Common/CrossLogin"

// Powerstation API Url
PowerStationURL string = "v2/PowerStation/GetMonitorDetailByPowerstationId"
Expand All @@ -16,7 +11,7 @@ const (
HTTPTimeout = 20

// Version string
VersionString string = "gogoodwe v2.0.0"
VersionString string = "gogoodwe v0.0.7"

//API login success response message
SemsLoginSuccessResponse string = "Successful"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ require (
github.com/logrusorgru/aurora v2.0.3+incompatible
)

require github.com/alexflint/go-scalar v1.2.0 // indirect
require github.com/alexflint/go-scalar v1.1.0 // indirect
3 changes: 1 addition & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
github.com/alexflint/go-arg v1.4.3 h1:9rwwEBpMXfKQKceuZfYcwuc/7YY7tWJbFsgG5cAU/uo=
github.com/alexflint/go-arg v1.4.3/go.mod h1:3PZ/wp/8HuqRZMUUgu7I+e1qcpUbvmS258mRXkFH4IA=
github.com/alexflint/go-scalar v1.1.0 h1:aaAouLLzI9TChcPXotr6gUhq+Scr8rl0P9P4PnltbhM=
github.com/alexflint/go-scalar v1.1.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
github.com/alexflint/go-scalar v1.2.0 h1:WR7JPKkeNpnYIOfHRa7ivM21aWAdHD0gEWHCx+WQBRw=
github.com/alexflint/go-scalar v1.2.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
72 changes: 0 additions & 72 deletions inverter/data.go

This file was deleted.

Loading

0 comments on commit 3e8e8b4

Please sign in to comment.