Skip to content

Commit a09263b

Browse files
authored
Added minor linter fixes. (google#311)
* Added Minor linter fixes. * More typos * upd
1 parent 0a038b6 commit a09263b

File tree

22 files changed

+43
-32
lines changed

22 files changed

+43
-32
lines changed

‎agent/llmagent/llmagent_saveoutput_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ func TestLlmAgent_MaybeSaveOutputToState(t *testing.T) {
119119
// The method modifies the event in-place, just like the Python version.
120120
createdAgent, err := New(tc.agentConfig)
121121
if err != nil {
122-
t.Fatal("failed to create agent: %w", err)
122+
t.Fatalf("failed to create agent: %v", err)
123123
}
124124
createdLlmAgent, ok := createdAgent.(*llmAgent)
125125
if !ok {
126-
t.Fatal("failed to create agent: %w", err)
126+
t.Fatalf("failed to convert to llmagent")
127127
}
128128
createdLlmAgent.maybeSaveOutputToState(tc.event)
129129

‎artifact/request_validation_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func TestSaveRequest_Validate(t *testing.T) {
102102
Part: genai.NewPartFromFunctionCall("example", nil),
103103
},
104104
wantErr: true,
105-
wantErrMsg: "invalid save request: Part.InlineData or Part.Text have to be set",
105+
wantErrMsg: "invalid save request: Part.InlineData or Part.Text has to be set",
106106
},
107107
{
108108
name: "Completely empty request",

‎artifact/service.go‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ type SaveRequest struct {
5656
// Part is the artifact to store.
5757
Part *genai.Part
5858

59-
// Belows are optional fields.
59+
// Below are optional fields.
6060

6161
// If set, the artifact will be saved with this version.
6262
// If unset, a new version will be created.
@@ -75,7 +75,7 @@ func validateRequiredStrings(fields []requiredField) []string {
7575
return missingFields
7676
}
7777

78-
// Validate checks if the struct is valid or if its missing field
78+
// Validate checks if the struct is valid or if it is missing fields.
7979
func (req *SaveRequest) Validate() error {
8080
// Define the fields to check in the desired order
8181
fieldsToCheck := []requiredField{
@@ -99,7 +99,7 @@ func (req *SaveRequest) Validate() error {
9999
}
100100

101101
if req.Part.Text == "" && req.Part.InlineData == nil {
102-
return fmt.Errorf("invalid save request: Part.InlineData or Part.Text have to be set")
102+
return fmt.Errorf("invalid save request: Part.InlineData or Part.Text has to be set")
103103
}
104104
return nil
105105
}
@@ -113,11 +113,11 @@ type SaveResponse struct {
113113
type LoadRequest struct {
114114
AppName, UserID, SessionID, FileName string
115115

116-
// Belows are optional fields.
116+
// Below are optional fields.
117117
Version int64
118118
}
119119

120-
// Validate checks if the struct is valid or if its missing field
120+
// Validate checks if the struct is valid or if it is missing fields.
121121
func (req *LoadRequest) Validate() error {
122122
// Define the fields to check in the desired order
123123
fieldsToCheck := []requiredField{
@@ -147,11 +147,11 @@ type LoadResponse struct {
147147
type DeleteRequest struct {
148148
AppName, UserID, SessionID, FileName string
149149

150-
// Belows are optional fields.
150+
// Below are optional fields.
151151
Version int64
152152
}
153153

154-
// Validate checks if the struct is valid or if its missing field
154+
// Validate checks if the struct is valid or if it is missing fields.
155155
func (req *DeleteRequest) Validate() error {
156156
// Define the fields to check in the desired order
157157
fieldsToCheck := []requiredField{
@@ -176,7 +176,7 @@ type ListRequest struct {
176176
AppName, UserID, SessionID string
177177
}
178178

179-
// Validate checks if the struct is valid or if its missing field
179+
// Validate checks if the struct is valid or if it is missing a field.
180180
func (req *ListRequest) Validate() error {
181181
// Define the fields to check in the desired order
182182
fieldsToCheck := []requiredField{

‎cmd/adkgo/internal/deploy/deploy.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"google.golang.org/adk/cmd/adkgo/internal/root"
2121
)
2222

23-
// deployCmd represents the deploy command.
23+
// DeployCmd represents the deploy command.
2424
var DeployCmd = &cobra.Command{
2525
Use: "deploy",
2626
Short: "Makes deployment to various platforms easy",

‎cmd/launcher/web/api/api.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ func (a *apiLauncher) SetupSubrouters(router *mux.Router, config *launcher.Confi
7777
router.Methods("GET", "POST", "DELETE", "OPTIONS").PathPrefix("/api/").Handler(
7878
http.StripPrefix("/api", corsHandler),
7979
)
80+
8081
return nil
8182
}
8283

‎cmd/launcher/web/webui/webui.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"google.golang.org/adk/server/adkrest/controllers"
3131
)
3232

33-
// webUIConfig contains parametres for lauching ADK Web UI
33+
// webUIConfig contains parameters for launching ADK Web UI
3434
type webUIConfig struct {
3535
backendAddress string
3636
pathPrefix string
@@ -52,7 +52,7 @@ func (w *webUILauncher) Keyword() string {
5252
return "webui"
5353
}
5454

55-
// Parse implements web.Sublauncher. After parsing webui-specific arguments returns remaining un-parsed arguments
55+
// Parse implements web.Sublauncher. After parsing webui-specific arguments returns remaining unparsed arguments
5656
func (w *webUILauncher) Parse(args []string) ([]string, error) {
5757
err := w.flags.Parse(args)
5858
if err != nil || !w.flags.Parsed() {

‎examples/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This folder hosts examples to test different features. The examples are usually
88
# Launcher
99
In many examples you can see such lines:
1010
```go
11-
l := full.NewLaucher()
11+
l := full.NewLauncher()
1212
err = l.ParseAndRun(ctx, config, os.Args[1:], universal.ErrorOnUnparsedArgs)
1313
if err != nil {
1414
log.Fatalf("run failed: %v\n\n%s", err, l.FormatSyntax())
@@ -24,4 +24,4 @@ it allows to to decide, which launching options are supported in the run-time.
2424

2525
Run `go run ./example/quickstart/main.go help` for details
2626

27-
As an alternative, you may want to use `prod.NewLaucher()` which only builds-in restapi and a2a launchers.
27+
As an alternative, you may want to use `prod.NewLauncher()` which only builds-in restapi and a2a launchers.

‎examples/web/agents/llmauditor.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ There are various actions you can take to help you with the verification:
6767
* You may search the web to find information that supports or contradicts the claim.
6868
* You may conduct multiple searches per claim if acquired evidence was insufficient.
6969
* In your reasoning please refer to the evidence you have collected so far via their squared brackets indices.
70-
* You may check the context to verify if the claim is consistent with the context. Read the context carefully to idenfity specific user instructions that the text should follow, facts that the text should be faithful to, etc.
70+
* You may check the context to verify if the claim is consistent with the context. Read the context carefully to identify specific user instructions that the text should follow, facts that the text should be faithful to, etc.
7171
* You should draw your final conclusion on the entire text after you acquired all the information you needed.
7272
7373
# Output format
@@ -217,7 +217,7 @@ func afterReviser(ctx agent.CallbackContext, llmResponse *model.LLMResponse, llm
217217
return llmResponse, nil
218218
}
219219

220-
func GetLLmAuditorAgent(ctx context.Context, model model.LLM) agent.Agent {
220+
func GetLLMAuditorAgent(ctx context.Context, model model.LLM) agent.Agent {
221221
criticAgent, err := llmagent.New(llmagent.Config{
222222
Model: model,
223223
Name: "critic_agent",

‎examples/web/main.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ func saveReportfunc(ctx agent.CallbackContext, llmResponse *model.LLMResponse, l
4848
return llmResponse, llmResponseError
4949
}
5050

51-
// needed to use 'user' for both a2a and webui (which are sharing the same sessions service)
51+
// AuthInterceptor sets 'user' name needed for both a2a and webui launchers which sharing the same sessions service.
5252
type AuthInterceptor struct {
5353
a2asrv.PassthroughCallInterceptor
5454
}
5555

56+
// Before implements a before request callback.
5657
func (a *AuthInterceptor) Before(ctx context.Context, callCtx *a2asrv.CallContext, req *a2asrv.Request) (context.Context, error) {
5758
callCtx.User = &a2asrv.AuthenticatedUser{
5859
UserName: "user",
@@ -84,7 +85,7 @@ func main() {
8485
if err != nil {
8586
log.Fatalf("Failed to create agent: %v", err)
8687
}
87-
llmAuditor := agents.GetLLmAuditorAgent(ctx, model)
88+
llmAuditor := agents.GetLLMAuditorAgent(ctx, model)
8889
imageGeneratorAgent := agents.GetImageGeneratorAgent(ctx, model)
8990

9091
agentLoader, err := agent.NewMultiLoader(

‎go.mod‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ require (
1616

1717
require (
1818
github.com/google/jsonschema-go v0.3.0
19+
github.com/google/safehtml v0.1.0
1920
github.com/modelcontextprotocol/go-sdk v0.7.0
2021
google.golang.org/grpc v1.76.0
2122
gorm.io/driver/sqlite v1.6.0

0 commit comments

Comments
 (0)