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 docs/ex/value-groups/consume/param.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package consume
import "go.uber.org/fx"

// Watcher watches for events.
type Watcher interface{}
type Watcher any

// ParamsModule is the module defined in this file.
var ParamsModule = fx.Options(
Expand Down
2 changes: 1 addition & 1 deletion docs/ex/value-groups/feed/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var ResultModule = fx.Options(
)

// Watcher watches for events.
type Watcher interface{}
type Watcher any

type watcher struct{}

Expand Down
2 changes: 1 addition & 1 deletion docs/src/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ it can only be used for non-interface values.
on runtime reflection to determine the type of the value.

Passing an interface value to `fx.Supply` is a lossy operation:
it loses the original interface type, only giving us `interface{}`,
it loses the original interface type, only giving us `any`,
at which point reflection will only reveal the concrete type of the value.

For example, consider:
Expand Down
4 changes: 2 additions & 2 deletions tools/analysis/passes/allfxevents/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var _filter = []ast.Node{
&ast.TypeAssertExpr{},
}

func run(pass *analysis.Pass) (interface{}, error) {
func run(pass *analysis.Pass) (any, error) {
fxeventPkg, ok := findPackage(pass.Pkg, "go.uber.org/fx/fxevent")
if !ok {
// If the package doesn't import fxevent, and itself isn't
Expand Down Expand Up @@ -261,7 +261,7 @@ func (ts *typeSet) Remove(t types.Type) (found bool) {

// Iterate iterates through the type set in an unspecified order.
func (ts *typeSet) Iterate(f func(types.Type)) {
ts.m.Iterate(func(t types.Type, _ interface{}) {
ts.m.Iterate(func(t types.Type, _ any) {
f(t)
})
}
Expand Down