Skip to content

feat: use new errors pkg in pkg/apis/* - #4720

Open
lacroixthomas wants to merge 2 commits into
agones-dev:mainfrom
lacroixthomas:features/integrate-errors-in-pkg-apis-pkg
Open

feat: use new errors pkg in pkg/apis/*#4720
lacroixthomas wants to merge 2 commits into
agones-dev:mainfrom
lacroixthomas:features/integrate-errors-in-pkg-apis-pkg

Conversation

@lacroixthomas

Copy link
Copy Markdown
Collaborator

What type of PR is this?
/kind cleanup

What this PR does / Why we need it:

Use the new error package (https://github.com/agones-dev/agones/blob/main/pkg/util/errors/errors.go) on the pkg/apis/* files

Which issue(s) this PR fixes:
Work on #4510

Did you use AI tools in preparing this PR?:
Y

Special notes for your reviewer:

Signed-off-by: Thomas Lacroix <thomas.lacroix@epitech.eu>
@github-actions github-actions Bot added kind/cleanup Refactoring code, fixing up documentation, etc size/S labels Sep 6, 2026
Comment thread pkg/apis/agones/v1/gameserver.go Outdated
}
}
return errors.Errorf("failed to find container named %s in pod spec", containerName)
return errs.Errorf("failed to find container named %s in pod spec", containerName)

@lacroixthomas lacroixthomas Sep 6, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's "not" * from within a struct and it's using a package level error, but it's because it's the pkg/apis/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 wait, why not put the errors library in the GameServer struct?

We don't want to recreate it on each invocation? (we could create a global one to reuse across gameservers that gets created on package creation on an empty GameServer struct?)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Youps my comment is wrong, it's the way around, we dont use the error at struct level but at global / package level *

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I didn't put that at struct level as there is no constructor, users will use it ditectly as the exported struct, which is why I set it as a global *

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh hmm, I think I just understood, let me check

@lacroixthomas lacroixthomas Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in using a global one as: var gameserverErrors= errors.FromStruct(&GameServer{}) or var gameserverErrors= errors.FromStruct[GameServer](nil)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated: af24164

Comment thread pkg/apis/agones/v1/v1.go Outdated
@lacroixthomas
lacroixthomas marked this pull request as ready for review September 6, 2026 22:30
@lacroixthomas
lacroixthomas requested a review from a team September 6, 2026 22:30
@agones-bot

Copy link
Copy Markdown
Collaborator

Build Succeeded 🥳

Build Id: 81e2b195-ab53-435d-a772-282862fdaca5

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

git fetch https://github.com/googleforgames/agones.git pull/4720/head:pr_4720 && git checkout pr_4720
helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.61.0-dev-f5efa8f

Signed-off-by: Thomas Lacroix <thomas.lacroix@epitech.eu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Refactoring code, fixing up documentation, etc size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants