cmd/wire: add a --header_file flag to the "gen" and "diff" commands (#175)
This commit is contained in:
29
internal/wire/testdata/Header/foo/foo.go
vendored
Normal file
29
internal/wire/testdata/Header/foo/foo.go
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2019 The Wire Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println(injectFoo())
|
||||
}
|
||||
|
||||
type Foo int
|
||||
|
||||
func provideFoo() Foo {
|
||||
return 41
|
||||
}
|
||||
26
internal/wire/testdata/Header/foo/wire.go
vendored
Normal file
26
internal/wire/testdata/Header/foo/wire.go
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2019 The Wire Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//+build wireinject
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/google/wire"
|
||||
)
|
||||
|
||||
func injectFoo() Foo {
|
||||
wire.Build(provideFoo)
|
||||
return Foo(0)
|
||||
}
|
||||
2
internal/wire/testdata/Header/header
vendored
Normal file
2
internal/wire/testdata/Header/header
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
// This is a sample header file.
|
||||
//
|
||||
1
internal/wire/testdata/Header/pkg
vendored
Normal file
1
internal/wire/testdata/Header/pkg
vendored
Normal file
@@ -0,0 +1 @@
|
||||
example.com/foo
|
||||
1
internal/wire/testdata/Header/want/program_out.txt
vendored
Normal file
1
internal/wire/testdata/Header/want/program_out.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
41
|
||||
15
internal/wire/testdata/Header/want/wire_gen.go
vendored
Normal file
15
internal/wire/testdata/Header/want/wire_gen.go
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// This is a sample header file.
|
||||
//
|
||||
// Code generated by Wire. DO NOT EDIT.
|
||||
|
||||
//go:generate wire
|
||||
//+build !wireinject
|
||||
|
||||
package main
|
||||
|
||||
// Injectors from wire.go:
|
||||
|
||||
func injectFoo() Foo {
|
||||
foo := provideFoo()
|
||||
return foo
|
||||
}
|
||||
Reference in New Issue
Block a user