Skip to content

Commit

Permalink
Merge pull request #2 from scanoss/linting-cleanup
Browse files Browse the repository at this point in the history
Golang License Fix
  • Loading branch information
eeisegn authored Nov 27, 2023
2 parents 209128f + 83b3946 commit c3afd24
Show file tree
Hide file tree
Showing 32 changed files with 563 additions and 720 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/sqldialects.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 0 additions & 104 deletions .idea/workspace.xml

This file was deleted.

7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Upcoming changes...

## [0.7.2] - 2023-11-27
### Added
- Added SQL tracing support for advanced debug
### Fixed
- Fixed issue with golang license reporting for certain components

## [0.7.1] - 2023-11-20
### Added
- Added Open Telemetry spans/traces/metrics
Expand Down Expand Up @@ -50,3 +56,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[0.6.0]: https://github.com/scanoss/papi/compare/v0.5.0...v0.6.0
[0.7.0]: https://github.com/scanoss/papi/compare/v0.6.0...v0.7.0
[0.7.1]: https://github.com/scanoss/papi/compare/v0.7.0...v0.7.1
[0.7.2]: https://github.com/scanoss/papi/compare/v0.7.1...v0.7.2
3 changes: 2 additions & 1 deletion config/app-config-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"Host": "localhost",
"User": "scanoss",
"Passwd": "secret123!",
"Schema": "scanoss"
"Schema": "scanoss",
"Trace": false
},
"Components": {
"CommitMissing": false
Expand Down
3 changes: 2 additions & 1 deletion config/app-config-docker-local-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"Host": "host.docker.internal",
"User": "scanoss",
"Passwd": "secret123!",
"Schema": "scanoss"
"Schema": "scanoss",
"Trace": false
},
"Components": {
"CommitMissing": false
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/lib/pq v1.10.9
github.com/mattn/go-sqlite3 v1.14.18
github.com/package-url/packageurl-go v0.1.2
github.com/scanoss/go-grpc-helper v0.2.0
github.com/scanoss/go-grpc-helper v0.3.0
github.com/scanoss/go-purl-helper v0.2.0
github.com/scanoss/papi v0.2.0
github.com/scanoss/zap-logging-helper v0.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca h1:NugYot0LIVPxTvN8n+Kvkn6TrbMyxQiuvKdEwFdR9vI=
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca/go.mod h1:uugorj2VCxiV1x+LzaIdVa9b4S4qGAcH6cbhh4qVxOU=
github.com/scanoss/go-grpc-helper v0.2.0 h1:Dy5tTU2T/7cti65m8UJNN5xIB+VXl8KXFQhg4ILe31I=
github.com/scanoss/go-grpc-helper v0.2.0/go.mod h1:bUkHdBfMhZnkYXTbELr0FUe7GntzcDIWM5Q7b9kuFaQ=
github.com/scanoss/go-grpc-helper v0.3.0 h1:4FeNOUX1X1uxZCd8pWz0iYwoPsH7cm4jK0yM3Mbuuvk=
github.com/scanoss/go-grpc-helper v0.3.0/go.mod h1:bUkHdBfMhZnkYXTbELr0FUe7GntzcDIWM5Q7b9kuFaQ=
github.com/scanoss/go-purl-helper v0.2.0 h1:kJBVv3euNhKQunoVFxiHxZLNHgSPAwTbz823oa3wcgw=
github.com/scanoss/go-purl-helper v0.2.0/go.mod h1:lAtt1KcKIUylaj8YW7Qn/jq5Vvwh8fV2huqfvT9SKLM=
github.com/scanoss/ipfilter/v2 v2.0.2 h1:GaB9i8kVJg9JQZm5XGStYkEpiaCVdsrj7ezI2wV/oh8=
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/server_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type ServerConfig struct {
Schema string `env:"DB_SCHEMA"`
SslMode string `env:"DB_SSL_MODE"` // enable/disable
Dsn string `env:"DB_DSN"`
Trace bool `env:"DB_TRACE"` // true/false
}
Components struct {
CommitMissing bool `env:"COMP_COMMIT_MISSING"` // Write component details to the DB if they are looked up live
Expand Down Expand Up @@ -98,6 +99,7 @@ func setServerConfigDefaults(cfg *ServerConfig) {
cfg.Database.User = "scanoss"
cfg.Database.Schema = "scanoss"
cfg.Database.SslMode = "disable"
cfg.Database.Trace = false
cfg.Components.CommitMissing = false
cfg.Logging.DynamicLogging = true
cfg.Logging.DynamicPort = "localhost:60051"
Expand Down
4 changes: 2 additions & 2 deletions pkg/dtos/dependency_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ type DepPurlInput struct {

// ParseDependencyInput converts the input byte array to a DependencyInput structure.
func ParseDependencyInput(s *zap.SugaredLogger, input []byte) (DependencyInput, error) {
if input == nil || len(input) == 0 {
if len(input) == 0 {
return DependencyInput{}, errors.New("no input dependency data supplied to parse")
}
var data DependencyInput
err := json.Unmarshal(input, &data)
if err != nil {
s.Errorf("Parse failure: %v", err)
return DependencyInput{}, errors.New(fmt.Sprintf("failed to parse dependency input data: %v", err))
return DependencyInput{}, fmt.Errorf("failed to parse dependency input data: %v", err)
}
return data, nil
}
10 changes: 5 additions & 5 deletions pkg/dtos/dependency_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type DependencyOutput struct {

type DependencyFileOutput struct {
File string `json:"file"`
Id string `json:"id"`
ID string `json:"id"`
Status string `json:"status"`
Dependencies []DependenciesOutput `json:"dependencies"`
}
Expand All @@ -39,14 +39,14 @@ type DependenciesOutput struct {
Component string `json:"component"`
Purl string `json:"purl"`
Version string `json:"version"`
Url string `json:"url"`
URL string `json:"url"`
Comment string `json:"comment"`
Licenses []DependencyLicense `json:"licenses"`
}

type DependencyLicense struct {
Name string `json:"name"`
SpdxId string `json:"spdx_id"`
SpdxID string `json:"spdx_id"`
IsSpdx bool `json:"is_spdx_approved"`
}

Expand All @@ -62,14 +62,14 @@ func ExportDependencyOutput(s *zap.SugaredLogger, output DependencyOutput) ([]by

// ParseDependencyOutput converts the input byte array to a DependencyOutput structure.
func ParseDependencyOutput(s *zap.SugaredLogger, input []byte) (DependencyOutput, error) {
if input == nil || len(input) == 0 {
if len(input) == 0 {
return DependencyOutput{}, errors.New("no output dependency data supplied to parse")
}
var data DependencyOutput
err := json.Unmarshal(input, &data)
if err != nil {
s.Errorf("Parse failure: %v", err)
return DependencyOutput{}, errors.New(fmt.Sprintf("failed to parse dependency output data: %v", err))
return DependencyOutput{}, fmt.Errorf("failed to parse dependency output data: %v", err)
}
return data, nil
}
Loading

0 comments on commit c3afd24

Please sign in to comment.