Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix workflow and go version #60

Merged
merged 5 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/code-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Code Check
on:
pull_request:
branches:
- "main"
- "v1210"
push:
branches:
- "main"
- "v1210"

permissions:
contents: read
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gosec-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ name: "Security Scan"
# The scheduled workflow runs every at 00:00 on Sunday UTC time.
on:
push:
branches: [ "main" ]
branches: [ "v1210" ]
pull_request:
branches: [ "main" ]
branches: [ "v1210" ]
schedule:
- cron: '0 0 * * 0'

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ require github.com/pingidentity/pingfederate-go-client/v1125 v1125.6.0

The `.6.0` refers to the version of this client module.

For detailed documentation, see the `README` and `docs/` folder in the `configurationapi/` folder.
For detailed documentation, see the `README` and `docs/` folder in the `configurationapi/` folder.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/pingidentity/pingfederate-go-client/v1210

go 1.18
go 1.21

require golang.org/x/oauth2 v0.20.0
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo=
golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
8 changes: 6 additions & 2 deletions scripts/updateClientAndConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
line = clientFile.readline()
# Use configuration.go method for UserAgent
if "User-Agent" in line:
line = line.replace("c.cfg.UserAgent", "c.cfg.UserAgent()")
line = line.replace("c.cfg.UserAgent)", "c.cfg.UserAgent())")
updatedClientLines.append(line)

with open("client.go", 'w') as clientFile:
Expand All @@ -25,6 +25,7 @@

# Update configuration.go
updatedConfigurationLines = []
userAgentMethodFound = False
with open("configuration.go", 'r') as configurationFile:
for line in configurationFile:
# Split UserAgent into two fields in the Configuration struct
Expand All @@ -35,10 +36,13 @@
# Remove UserAgent from the default configuration struct
if "UserAgent:" in line:
continue
if "UserAgent()" in line:
userAgentMethodFound = True
updatedConfigurationLines.append(line)

# Add new UserAgent() method with default that handle override and suffix
updatedConfigurationLines.append("""
if not userAgentMethodFound:
updatedConfigurationLines.append("""
func (c *Configuration) UserAgent() string {
if c.UserAgentOverride != nil {
return *c.UserAgentOverride
Expand Down