Skip to content
Open
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
2 changes: 1 addition & 1 deletion benchmarks/benchserver/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/runner/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/casing.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/casing_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/client_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/gateway.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/gateway_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/header_propagate.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/header_propagate_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/method.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/mockgen.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 7 additions & 6 deletions codegen/module.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -1736,11 +1736,12 @@ func (info *PackageInfo) ModulePackageAlias() string {

// ModuleInstance is a configured module inside a module class directory.
// For example, this could be
// ClassName: "Endpoint,
// ClassType: "http",
// BaseDirectory "/path/to/service/base/"
// Directory: "clients/health/"
// InstanceName: "health",
//
// ClassName: "Endpoint,
// ClassType: "http",
// BaseDirectory "/path/to/service/base/"
// Directory: "clients/health/"
// InstanceName: "health",
type ModuleInstance struct {
// genSpec is used to share generated specs across dependencies. Generators
// should not mutate this directly, and should return the spec as a result.
Expand Down
2 changes: 1 addition & 1 deletion codegen/module_system.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/module_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/package.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/package_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/post_gen_hooks.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/proto.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
20 changes: 10 additions & 10 deletions codegen/proto_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -32,23 +32,23 @@ const (
singleServiceSpec = `
syntax = "proto3";
package echo;

message Request { string message = 1; }
message Response { string message = 1; }

service EchoService {
rpc EchoMethod(Request) returns (Response);
}
`
multiServiceSpec = `
syntax = "proto3";
package echo;

message Request1 { string message = 1; }
message Response1 { string message = 1; }
message Request2 { string message = 1; }
message Response2 { string message = 1; }

service EchoService {
rpc EchoMethod1(Request1) returns (Response1);
rpc EchoMethod2(Request2) returns (Response2);
Expand All @@ -57,11 +57,11 @@ const (
mixedServiceSpec = `
syntax = "proto3";
package echo;

message Request1 { string message = 1; }
message Response1 { string message = 1; }
message Response2 { string message = 1; }

service EchoService {
rpc EchoMethod1(Request1) returns (Response1);
rpc EchoMethod2(Request1) returns (Response2);
Expand All @@ -70,17 +70,17 @@ const (
noServiceSpec = `
syntax = "proto3";
package echo;

message Request { string message = 1; }
message Response { string message = 1; }
`
emptyServiceSpec = `
syntax = "proto3";
package echo;

message Request { string message = 1; }
message Response { string message = 1; }

service EchoService {}
`
)
Expand Down
2 changes: 1 addition & 1 deletion codegen/reflect_interface.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/runner/runner.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/service.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/service_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/template.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions codegen/template_bundle/template_files.go

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

2 changes: 1 addition & 1 deletion codegen/template_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/templates/tchannel_endpoint.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
{{- $clientID := .ClientID }}

{{with .Method -}}
// New{{$handlerName}} creates a handler to be registered with a thrift server.
// New{{$handlerName}} creates a simple handler to be registered with a thrift server.
func New{{$handlerName}}(deps *module.Dependencies) *{{$handlerName}} {
handler := &{{$handlerName}}{
Deps: deps,
Expand Down
2 changes: 1 addition & 1 deletion codegen/thrift.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/thrift_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
26 changes: 14 additions & 12 deletions codegen/type_converter.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Uber Technologies, Inc.
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -120,7 +120,7 @@ func (c *TypeConverter) getGoTypeName(valueType compile.TypeSpec) (string, error
return GoType(c.Helper, valueType)
}

// input of "A.B.C.D" returns ["A","A.B", "A.B.C", "A.B.C.D"]
// input of "A.B.C.D" returns ["A","A.B", "A.B.C", "A.B.C.D"]
func getMiddleIdentifiers(identifier string) []string {
subIds := strings.Split(identifier, ".")

Expand All @@ -134,7 +134,7 @@ func getMiddleIdentifiers(identifier string) []string {
return middleIds
}

// converts a list of identifier paths into boolean nil check expressions on those paths
// converts a list of identifier paths into boolean nil check expressions on those paths
func convertIdentifiersToNilChecks(identifiers []string) []string {
checks := make([]string, 0, len(identifiers)-1)

Expand Down Expand Up @@ -641,13 +641,14 @@ func (c *TypeConverter) genConverterForMap(
}

// recursive function to walk a DFS on toFields and try to assign fromFields or fieldMap tranforms
// generated code is appended as we traverse the toFields thrift type structure
// keyPrefix - the identifier (path) of the current position in the "to" struct
// fromPrefix - the identifier (path) of the corresponding position in the "from" struct
// indent - a string of tabs for current block scope
// fromFields - fields in the current from struct, can be nil if only fieldMap transforms are applicable in the path
// toFields - fields in the current to struct
// fieldMap - a data structure specifying configured transforms Map[toIdentifier ] -> fromField FieldMapperEntry
//
// generated code is appended as we traverse the toFields thrift type structure
// keyPrefix - the identifier (path) of the current position in the "to" struct
// fromPrefix - the identifier (path) of the corresponding position in the "from" struct
// indent - a string of tabs for current block scope
// fromFields - fields in the current from struct, can be nil if only fieldMap transforms are applicable in the path
// toFields - fields in the current to struct
// fieldMap - a data structure specifying configured transforms Map[toIdentifier ] -> fromField FieldMapperEntry
func (c *TypeConverter) genStructConverter(
keyPrefix string,
fromPrefix string,
Expand Down Expand Up @@ -1291,8 +1292,9 @@ func isRecursiveStruct(spec compile.TypeSpec, seenSoFar map[string]bool) bool {

// Returns true if any of the fields of a struct form a cycle anywhere down the line
// e.g. struct A has optional field of type A -> cycle of length 0
// struct A has optional field of type B; struct B has optional field of type A -> cycle of length 2
// struct A has optional field of type B; struct B has optional field of type B -> cycle of length 0 downstream
//
// struct A has optional field of type B; struct B has optional field of type A -> cycle of length 2
// struct A has optional field of type B; struct B has optional field of type B -> cycle of length 0 downstream
func (c *TypeConverter) isRecursiveStruct(fields []*compile.FieldSpec) bool {
for _, field := range fields {
if isRecursiveStruct(field.Type, make(map[string]bool)) {
Expand Down
Loading