Resolve issues identifies by staticcheck

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2025-02-06 21:49:35 -07:00
parent 3f652ceb02
commit a0179f1432
18 changed files with 895 additions and 1501 deletions

View File

@@ -1,6 +1,9 @@
// Routes for the wwapi (WareWulf API).
// TODO: Try protoc-gen-doc for generating documentation.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc-gen-go-grpc v1.5.1
// - protoc v4.24.0
// source: routes.proto
@@ -16,12 +19,30 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
WWApi_ImageBuild_FullMethodName = "/wwapi.v1.WWApi/ImageBuild"
WWApi_ImageDelete_FullMethodName = "/wwapi.v1.WWApi/ImageDelete"
WWApi_ImageCopy_FullMethodName = "/wwapi.v1.WWApi/ImageCopy"
WWApi_ImageImport_FullMethodName = "/wwapi.v1.WWApi/ImageImport"
WWApi_ImageList_FullMethodName = "/wwapi.v1.WWApi/ImageList"
WWApi_ImageShow_FullMethodName = "/wwapi.v1.WWApi/ImageShow"
WWApi_ImageRename_FullMethodName = "/wwapi.v1.WWApi/ImageRename"
WWApi_NodeAdd_FullMethodName = "/wwapi.v1.WWApi/NodeAdd"
WWApi_NodeDelete_FullMethodName = "/wwapi.v1.WWApi/NodeDelete"
WWApi_NodeList_FullMethodName = "/wwapi.v1.WWApi/NodeList"
WWApi_NodeSet_FullMethodName = "/wwapi.v1.WWApi/NodeSet"
WWApi_NodeStatus_FullMethodName = "/wwapi.v1.WWApi/NodeStatus"
WWApi_Version_FullMethodName = "/wwapi.v1.WWApi/Version"
)
// WWApiClient is the client API for WWApi service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// WWApi defines the wwapid service web interface.
type WWApiClient interface {
// ImageBuild builds zero or more images.
ImageBuild(ctx context.Context, in *ImageBuildParameter, opts ...grpc.CallOption) (*ImageListResponse, error)
@@ -62,8 +83,9 @@ func NewWWApiClient(cc grpc.ClientConnInterface) WWApiClient {
}
func (c *wWApiClient) ImageBuild(ctx context.Context, in *ImageBuildParameter, opts ...grpc.CallOption) (*ImageListResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ImageListResponse)
err := c.cc.Invoke(ctx, "/wwapi.v1.WWApi/ImageBuild", in, out, opts...)
err := c.cc.Invoke(ctx, WWApi_ImageBuild_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -71,8 +93,9 @@ func (c *wWApiClient) ImageBuild(ctx context.Context, in *ImageBuildParameter, o
}
func (c *wWApiClient) ImageDelete(ctx context.Context, in *ImageDeleteParameter, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, "/wwapi.v1.WWApi/ImageDelete", in, out, opts...)
err := c.cc.Invoke(ctx, WWApi_ImageDelete_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -80,8 +103,9 @@ func (c *wWApiClient) ImageDelete(ctx context.Context, in *ImageDeleteParameter,
}
func (c *wWApiClient) ImageCopy(ctx context.Context, in *ImageCopyParameter, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, "/wwapi.v1.WWApi/ImageCopy", in, out, opts...)
err := c.cc.Invoke(ctx, WWApi_ImageCopy_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -89,8 +113,9 @@ func (c *wWApiClient) ImageCopy(ctx context.Context, in *ImageCopyParameter, opt
}
func (c *wWApiClient) ImageImport(ctx context.Context, in *ImageImportParameter, opts ...grpc.CallOption) (*ImageListResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ImageListResponse)
err := c.cc.Invoke(ctx, "/wwapi.v1.WWApi/ImageImport", in, out, opts...)
err := c.cc.Invoke(ctx, WWApi_ImageImport_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -98,8 +123,9 @@ func (c *wWApiClient) ImageImport(ctx context.Context, in *ImageImportParameter,
}
func (c *wWApiClient) ImageList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ImageListResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ImageListResponse)
err := c.cc.Invoke(ctx, "/wwapi.v1.WWApi/ImageList", in, out, opts...)
err := c.cc.Invoke(ctx, WWApi_ImageList_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -107,8 +133,9 @@ func (c *wWApiClient) ImageList(ctx context.Context, in *emptypb.Empty, opts ...
}
func (c *wWApiClient) ImageShow(ctx context.Context, in *ImageShowParameter, opts ...grpc.CallOption) (*ImageShowResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ImageShowResponse)
err := c.cc.Invoke(ctx, "/wwapi.v1.WWApi/ImageShow", in, out, opts...)
err := c.cc.Invoke(ctx, WWApi_ImageShow_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -116,8 +143,9 @@ func (c *wWApiClient) ImageShow(ctx context.Context, in *ImageShowParameter, opt
}
func (c *wWApiClient) ImageRename(ctx context.Context, in *ImageRenameParameter, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, "/wwapi.v1.WWApi/ImageRename", in, out, opts...)
err := c.cc.Invoke(ctx, WWApi_ImageRename_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -125,8 +153,9 @@ func (c *wWApiClient) ImageRename(ctx context.Context, in *ImageRenameParameter,
}
func (c *wWApiClient) NodeAdd(ctx context.Context, in *NodeAddParameter, opts ...grpc.CallOption) (*NodeListResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(NodeListResponse)
err := c.cc.Invoke(ctx, "/wwapi.v1.WWApi/NodeAdd", in, out, opts...)
err := c.cc.Invoke(ctx, WWApi_NodeAdd_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -134,8 +163,9 @@ func (c *wWApiClient) NodeAdd(ctx context.Context, in *NodeAddParameter, opts ..
}
func (c *wWApiClient) NodeDelete(ctx context.Context, in *NodeDeleteParameter, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, "/wwapi.v1.WWApi/NodeDelete", in, out, opts...)
err := c.cc.Invoke(ctx, WWApi_NodeDelete_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -143,8 +173,9 @@ func (c *wWApiClient) NodeDelete(ctx context.Context, in *NodeDeleteParameter, o
}
func (c *wWApiClient) NodeList(ctx context.Context, in *NodeNames, opts ...grpc.CallOption) (*NodeListResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(NodeListResponse)
err := c.cc.Invoke(ctx, "/wwapi.v1.WWApi/NodeList", in, out, opts...)
err := c.cc.Invoke(ctx, WWApi_NodeList_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -152,8 +183,9 @@ func (c *wWApiClient) NodeList(ctx context.Context, in *NodeNames, opts ...grpc.
}
func (c *wWApiClient) NodeSet(ctx context.Context, in *ConfSetParameter, opts ...grpc.CallOption) (*NodeListResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(NodeListResponse)
err := c.cc.Invoke(ctx, "/wwapi.v1.WWApi/NodeSet", in, out, opts...)
err := c.cc.Invoke(ctx, WWApi_NodeSet_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -161,8 +193,9 @@ func (c *wWApiClient) NodeSet(ctx context.Context, in *ConfSetParameter, opts ..
}
func (c *wWApiClient) NodeStatus(ctx context.Context, in *NodeNames, opts ...grpc.CallOption) (*NodeStatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(NodeStatusResponse)
err := c.cc.Invoke(ctx, "/wwapi.v1.WWApi/NodeStatus", in, out, opts...)
err := c.cc.Invoke(ctx, WWApi_NodeStatus_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -170,8 +203,9 @@ func (c *wWApiClient) NodeStatus(ctx context.Context, in *NodeNames, opts ...grp
}
func (c *wWApiClient) Version(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*VersionResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(VersionResponse)
err := c.cc.Invoke(ctx, "/wwapi.v1.WWApi/Version", in, out, opts...)
err := c.cc.Invoke(ctx, WWApi_Version_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -180,7 +214,9 @@ func (c *wWApiClient) Version(ctx context.Context, in *emptypb.Empty, opts ...gr
// WWApiServer is the server API for WWApi service.
// All implementations must embed UnimplementedWWApiServer
// for forward compatibility
// for forward compatibility.
//
// WWApi defines the wwapid service web interface.
type WWApiServer interface {
// ImageBuild builds zero or more images.
ImageBuild(context.Context, *ImageBuildParameter) (*ImageListResponse, error)
@@ -213,9 +249,12 @@ type WWApiServer interface {
mustEmbedUnimplementedWWApiServer()
}
// UnimplementedWWApiServer must be embedded to have forward compatible implementations.
type UnimplementedWWApiServer struct {
}
// UnimplementedWWApiServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedWWApiServer struct{}
func (UnimplementedWWApiServer) ImageBuild(context.Context, *ImageBuildParameter) (*ImageListResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ImageBuild not implemented")
@@ -257,6 +296,7 @@ func (UnimplementedWWApiServer) Version(context.Context, *emptypb.Empty) (*Versi
return nil, status.Errorf(codes.Unimplemented, "method Version not implemented")
}
func (UnimplementedWWApiServer) mustEmbedUnimplementedWWApiServer() {}
func (UnimplementedWWApiServer) testEmbeddedByValue() {}
// UnsafeWWApiServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to WWApiServer will
@@ -266,6 +306,13 @@ type UnsafeWWApiServer interface {
}
func RegisterWWApiServer(s grpc.ServiceRegistrar, srv WWApiServer) {
// If the following call pancis, it indicates UnimplementedWWApiServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&WWApi_ServiceDesc, srv)
}
@@ -279,7 +326,7 @@ func _WWApi_ImageBuild_Handler(srv interface{}, ctx context.Context, dec func(in
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/wwapi.v1.WWApi/ImageBuild",
FullMethod: WWApi_ImageBuild_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WWApiServer).ImageBuild(ctx, req.(*ImageBuildParameter))
@@ -297,7 +344,7 @@ func _WWApi_ImageDelete_Handler(srv interface{}, ctx context.Context, dec func(i
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/wwapi.v1.WWApi/ImageDelete",
FullMethod: WWApi_ImageDelete_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WWApiServer).ImageDelete(ctx, req.(*ImageDeleteParameter))
@@ -315,7 +362,7 @@ func _WWApi_ImageCopy_Handler(srv interface{}, ctx context.Context, dec func(int
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/wwapi.v1.WWApi/ImageCopy",
FullMethod: WWApi_ImageCopy_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WWApiServer).ImageCopy(ctx, req.(*ImageCopyParameter))
@@ -333,7 +380,7 @@ func _WWApi_ImageImport_Handler(srv interface{}, ctx context.Context, dec func(i
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/wwapi.v1.WWApi/ImageImport",
FullMethod: WWApi_ImageImport_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WWApiServer).ImageImport(ctx, req.(*ImageImportParameter))
@@ -351,7 +398,7 @@ func _WWApi_ImageList_Handler(srv interface{}, ctx context.Context, dec func(int
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/wwapi.v1.WWApi/ImageList",
FullMethod: WWApi_ImageList_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WWApiServer).ImageList(ctx, req.(*emptypb.Empty))
@@ -369,7 +416,7 @@ func _WWApi_ImageShow_Handler(srv interface{}, ctx context.Context, dec func(int
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/wwapi.v1.WWApi/ImageShow",
FullMethod: WWApi_ImageShow_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WWApiServer).ImageShow(ctx, req.(*ImageShowParameter))
@@ -387,7 +434,7 @@ func _WWApi_ImageRename_Handler(srv interface{}, ctx context.Context, dec func(i
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/wwapi.v1.WWApi/ImageRename",
FullMethod: WWApi_ImageRename_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WWApiServer).ImageRename(ctx, req.(*ImageRenameParameter))
@@ -405,7 +452,7 @@ func _WWApi_NodeAdd_Handler(srv interface{}, ctx context.Context, dec func(inter
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/wwapi.v1.WWApi/NodeAdd",
FullMethod: WWApi_NodeAdd_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WWApiServer).NodeAdd(ctx, req.(*NodeAddParameter))
@@ -423,7 +470,7 @@ func _WWApi_NodeDelete_Handler(srv interface{}, ctx context.Context, dec func(in
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/wwapi.v1.WWApi/NodeDelete",
FullMethod: WWApi_NodeDelete_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WWApiServer).NodeDelete(ctx, req.(*NodeDeleteParameter))
@@ -441,7 +488,7 @@ func _WWApi_NodeList_Handler(srv interface{}, ctx context.Context, dec func(inte
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/wwapi.v1.WWApi/NodeList",
FullMethod: WWApi_NodeList_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WWApiServer).NodeList(ctx, req.(*NodeNames))
@@ -459,7 +506,7 @@ func _WWApi_NodeSet_Handler(srv interface{}, ctx context.Context, dec func(inter
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/wwapi.v1.WWApi/NodeSet",
FullMethod: WWApi_NodeSet_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WWApiServer).NodeSet(ctx, req.(*ConfSetParameter))
@@ -477,7 +524,7 @@ func _WWApi_NodeStatus_Handler(srv interface{}, ctx context.Context, dec func(in
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/wwapi.v1.WWApi/NodeStatus",
FullMethod: WWApi_NodeStatus_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WWApiServer).NodeStatus(ctx, req.(*NodeNames))
@@ -495,7 +542,7 @@ func _WWApi_Version_Handler(srv interface{}, ctx context.Context, dec func(inter
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/wwapi.v1.WWApi/Version",
FullMethod: WWApi_Version_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WWApiServer).Version(ctx, req.(*emptypb.Empty))