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
17 changes: 14 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Lint

on:
push:
branches: [ master, main ]
branches: [master, main]
pull_request:
branches: [ master, main ]
branches: [master, main]

jobs:
golangci:
Expand All @@ -23,7 +23,7 @@ jobs:
uses: golangci/golangci-lint-action@v9.2.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: v2.2.1
version: latest

- name: Install Buf
uses: bufbuild/buf-action@v1
Expand All @@ -43,3 +43,14 @@ jobs:
git diff
exit 1
fi

- name: Go Generate and Check
run: |
go generate ./...
if ! git diff --quiet; then
echo "Error: 'go generate ./...' produced uncommitted changes."
echo "Run 'go generate ./...' locally and commit the result."
git status --short
git diff
exit 1
fi
4 changes: 2 additions & 2 deletions .github/workflows/publish-module-to-bsr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Publish modules to the BSR

on:
push:
branches: [ master, main ]
tags: [ "*" ]
branches: [master, main]
tags: ["*"]

jobs:
push-module:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release

on:
release:
types: [ published ]
types: [published]
workflow_dispatch:

jobs:
Expand All @@ -12,8 +12,8 @@ jobs:
if: startsWith(github.event.release.tag_name, 'cmd/tableauc/')
strategy:
matrix:
goos: [ linux, darwin, windows ]
goarch: [ amd64, arm64 ]
goos: [linux, darwin, windows]
goarch: [amd64, arm64]
exclude:
- goos: linux
goarch: arm64
Expand All @@ -27,7 +27,8 @@ jobs:
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: "1.24.x"
go-version-file: go.mod
cache-dependency-path: go.sum

- name: Download dependencies
run: |
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Testing
# Trigger on pushes, PRs (excluding documentation changes), and nightly.
on:
push:
branches: [ master, main ]
branches: [master, main]
pull_request:
schedule:
- cron: 0 0 * * * # daily at 00:00
Expand All @@ -16,20 +16,20 @@ jobs:
test:
strategy:
matrix:
go-version: [ 1.24.x ]
os: [ ubuntu-latest, windows-latest ]
targetplatform: [ x86, x64 ]
os: [ubuntu-latest, windows-latest]
targetplatform: [x86, x64]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout Code
uses: actions/checkout@v6

- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}

- name: Checkout Code
uses: actions/checkout@v6
go-version-file: go.mod
cache-dependency-path: go.sum

- name: Vet
run: go vet ./...
Expand Down
12 changes: 8 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/tableauio/tableau

go 1.24.0
go 1.25.6

require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260209202127-80ab13bee0bf.1
buf.build/go/protovalidate v1.1.3
github.com/bufbuild/protocompile v0.14.1
github.com/bufbuild/protocompile v0.14.2-0.20260429155904-12ef1ef2ce91
github.com/emirpasic/gods v1.18.1
github.com/protocolbuffers/txtpbfmt v0.0.0-20240820135758-21b1d9897dc7
github.com/rogpeppe/go-internal v1.10.0
Expand All @@ -15,14 +15,15 @@ require (
github.com/valyala/fastjson v1.6.10
github.com/xuri/excelize/v2 v2.9.0
go.uber.org/zap v1.27.1
golang.org/x/sync v0.16.0
golang.org/x/sync v0.20.0
golang.org/x/text v0.28.0
google.golang.org/protobuf v1.36.11
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/yaml.v3 v3.0.1
)

require (
buf.build/gen/go/bufbuild/protodescriptor/protocolbuffers/go v1.36.11-20250109164928-1da0de137947.1 // indirect
cel.dev/expr v0.25.1 // indirect
github.com/antchfx/xpath v1.3.6 // indirect
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
Expand All @@ -31,15 +32,18 @@ require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/petermattis/goid v0.0.0-20250319124200-ccd6737f222a // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/richardlehane/mscfb v1.0.4 // indirect
github.com/richardlehane/msoleps v1.0.4 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/spf13/pflag v1.0.9 // indirect
github.com/tidwall/btree v1.8.1 // indirect
github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d // indirect
github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/crypto v0.36.0 // indirect
golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 // indirect
golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirect
golang.org/x/net v0.37.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250811230008-5f3141c8851a // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250811230008-5f3141c8851a // indirect
Expand Down
24 changes: 18 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
buf.build/gen/go/bufbuild/protodescriptor/protocolbuffers/go v1.36.11-20250109164928-1da0de137947.1 h1:HwzzCRS4ZrEm1++rzSDxHnO0DOjiT1b8I/24e8a4exY=
buf.build/gen/go/bufbuild/protodescriptor/protocolbuffers/go v1.36.11-20250109164928-1da0de137947.1/go.mod h1:8PRKXhgNes29Tjrnv8KdZzg3I1QceOkzibW1QK7EXv0=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260209202127-80ab13bee0bf.1 h1:PMmTMyvHScV9Mn8wc6ASge9uRcHy0jtqPd+fM35LmsQ=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260209202127-80ab13bee0bf.1/go.mod h1:tvtbpgaVXZX4g6Pn+AnzFycuRK3MOz5HJfEGeEllXYM=
buf.build/go/protovalidate v1.1.3 h1:m2GVEgQWd7rk+vIoAZ+f0ygGjvQTuqPQapBBdcpWVPE=
Expand All @@ -9,10 +11,12 @@ github.com/antchfx/xpath v1.3.6 h1:s0y+ElRRtTQdfHP609qFu0+c6bglDv20pqOViQjjdPI=
github.com/antchfx/xpath v1.3.6/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=
github.com/bmatcuk/doublestar/v4 v4.10.0 h1:zU9WiOla1YA122oLM6i4EXvGW62DvKZVxIe6TYWexEs=
github.com/bmatcuk/doublestar/v4 v4.10.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
github.com/brianvoe/gofakeit/v6 v6.28.0 h1:Xib46XXuQfmlLS2EXRuJpqcw8St6qSZz75OUo0tgAW4=
github.com/brianvoe/gofakeit/v6 v6.28.0/go.mod h1:Xj58BMSnFqcn/fAQeSK+/PLtC5kSb7FJIq4JyGa8vEs=
github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw=
github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c=
github.com/bufbuild/protocompile v0.14.2-0.20260429155904-12ef1ef2ce91 h1:RPIMBLTMx/CRy0NVyb6yJDlGx2Vo84FsU+kAh46zqIA=
github.com/bufbuild/protocompile v0.14.2-0.20260429155904-12ef1ef2ce91/go.mod h1:DhgqsRznX/F0sGkUYtTQJRP+q8xMReQRQ3qr+n1opWU=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -34,15 +38,21 @@ github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQ
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/petermattis/goid v0.0.0-20250319124200-ccd6737f222a h1:S+AGcmAESQ0pXCUNnRH7V+bOUIgkSX5qVt2cNKCrm0Q=
github.com/petermattis/goid v0.0.0-20250319124200-ccd6737f222a/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/protocolbuffers/protoscope v0.0.0-20221109213918-8e7a6aafa2c9 h1:arwj11zP0yJIxIRiDn22E0H8PxfF7TsTrc2wIPFIsf4=
github.com/protocolbuffers/protoscope v0.0.0-20221109213918-8e7a6aafa2c9/go.mod h1:SKZx6stCn03JN3BOWTwvVIO2ajMkb/zQdTceXYhKw/4=
github.com/protocolbuffers/txtpbfmt v0.0.0-20240820135758-21b1d9897dc7 h1:GkKZUEPNgwIk3LK4Er5vxnaNKk1pdjI3Oc6oTBwBsxQ=
github.com/protocolbuffers/txtpbfmt v0.0.0-20240820135758-21b1d9897dc7/go.mod h1:jgxiZysxFPM+iWKwQwPR+y+Jvo54ARd4EisXxKYpB5c=
github.com/richardlehane/mscfb v1.0.4 h1:WULscsljNPConisD5hR0+OyZjwK46Pfyr6mPu5ZawpM=
github.com/richardlehane/mscfb v1.0.4/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk=
github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
github.com/richardlehane/msoleps v1.0.4 h1:WuESlvhX3gH2IHcd8UqyCuFY5yiq/GR/yqaSM/9/g00=
github.com/richardlehane/msoleps v1.0.4/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rodaine/protogofakeit v0.1.1 h1:ZKouljuRM3A+TArppfBqnH8tGZHOwM/pjvtXe9DaXH8=
github.com/rodaine/protogofakeit v0.1.1/go.mod h1:pXn/AstBYMaSfc1/RqH3N82pBuxtWgejz1AlYpY1mI0=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
Expand All @@ -56,6 +66,8 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/subchen/go-xmldom v1.1.2 h1:7evI2YqfYYOnuj+PBwyaOZZYjl3iWq35P6KfBUw9jeU=
github.com/subchen/go-xmldom v1.1.2/go.mod h1:6Pg/HuX5/T4Jlj0IPJF1sRxKVoI/rrKP6LIMge9d5/8=
github.com/tidwall/btree v1.8.1 h1:27ehoXvm5AG/g+1VxLS1SD3vRhp/H7LuEfwNvddEdmA=
github.com/tidwall/btree v1.8.1/go.mod h1:jBbTdUWhSZClZWoDg54VnvV7/54modSOzDN7VXftj1A=
github.com/valyala/fastjson v1.6.10 h1:/yjJg8jaVQdYR3arGxPE2X5z89xrlhS0eGXdv+ADTh4=
github.com/valyala/fastjson v1.6.10/go.mod h1:e6FubmQouUNP73jtMLmcbxS6ydWIpOfhz34TSfO3JaE=
github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d h1:llb0neMWDQe87IzJLS4Ci7psK/lVsjIS2otl+1WyRyY=
Expand All @@ -74,14 +86,14 @@ go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 h1:SbTAbRFnd5kjQXbczszQ0hdk3ctwYf3qBNH9jIsGclE=
golang.org/x/exp v0.0.0-20250813145105-42675adae3e6/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4=
golang.org/x/exp v0.0.0-20250911091902-df9299821621 h1:2id6c1/gto0kaHYyrixvknJ8tUK/Qs5IsmBtrc+FtgU=
golang.org/x/exp v0.0.0-20250911091902-df9299821621/go.mod h1:TwQYMMnGpvZyc+JpB/UAuTNIsVJifOlSkrZkhcvpVUk=
golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ=
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
google.golang.org/genproto/googleapis/api v0.0.0-20250811230008-5f3141c8851a h1:DMCgtIAIQGZqJXMVzJF4MV8BlWoJh2ZuFiRdAleyr58=
Expand Down
2 changes: 1 addition & 1 deletion internal/protogen/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ func (x *sheetExporter) findMDFromGeneratedProtos(name string) protoreflect.Mess
return nil
}
fullName := protoreflect.FullName(x.be.ProtoPackage).Append(protoreflect.Name(name))
descriptor, err := x.be.gen.ProtoRegistryFilesWithGenerated.FindDescriptorByName(fullName)
descriptor, err := x.be.gen.GetProtoRegistryFilesWithGenerated().FindDescriptorByName(fullName)
if err != nil {
return nil
}
Expand Down
10 changes: 5 additions & 5 deletions internal/protogen/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ func Test_sheetExporter_exportStruct(t *testing.T) {
OutputOpt: &options.ProtoOutputOption{
PreserveFieldNumbers: true,
},
ProtoRegistryFilesWithGenerated: protoregistry.GlobalFiles,
protoRegistryFilesWithGenerated: protoregistry.GlobalFiles,
},
},
typeInfos: &xproto.TypeInfos{},
Expand Down Expand Up @@ -662,7 +662,7 @@ func Test_sheetExporter_exportStruct(t *testing.T) {
OutputOpt: &options.ProtoOutputOption{
PreserveFieldNumbers: true,
},
ProtoRegistryFilesWithGenerated: protoregistry.GlobalFiles,
protoRegistryFilesWithGenerated: protoregistry.GlobalFiles,
},
},
typeInfos: &xproto.TypeInfos{},
Expand Down Expand Up @@ -789,7 +789,7 @@ func Test_sheetExporter_exportUnion(t *testing.T) {
OutputOpt: &options.ProtoOutputOption{
PreserveFieldNumbers: true,
},
ProtoRegistryFilesWithGenerated: protoregistry.GlobalFiles,
protoRegistryFilesWithGenerated: protoregistry.GlobalFiles,
},
},
typeInfos: &xproto.TypeInfos{},
Expand Down Expand Up @@ -1010,7 +1010,7 @@ func Test_sheetExporter_exportMessager(t *testing.T) {
OutputOpt: &options.ProtoOutputOption{
PreserveFieldNumbers: true,
},
ProtoRegistryFilesWithGenerated: protoregistry.GlobalFiles,
protoRegistryFilesWithGenerated: protoregistry.GlobalFiles,
},
},
typeInfos: &xproto.TypeInfos{},
Expand Down Expand Up @@ -1092,7 +1092,7 @@ func Test_sheetExporter_exportMessager(t *testing.T) {
OutputOpt: &options.ProtoOutputOption{
PreserveFieldNumbers: true,
},
ProtoRegistryFilesWithGenerated: protoregistry.GlobalFiles,
protoRegistryFilesWithGenerated: protoregistry.GlobalFiles,
},
},
typeInfos: &xproto.TypeInfos{},
Expand Down
42 changes: 34 additions & 8 deletions internal/protogen/protogen.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,17 @@ type Generator struct {
InputOpt *options.ProtoInputOption
OutputOpt *options.ProtoOutputOption

ProtoRegistryFiles, ProtoRegistryFilesWithGenerated *protoregistry.Files
ProtoRegistryTypes *dynamicpb.Types
ProtoRegistryFiles *protoregistry.Files
ProtoRegistryTypes *dynamicpb.Types

// internal
typeInfos *xproto.TypeInfos // predefined type infos
collector *xerrors.Collector // concurrent error collector shared across the generator.

// used in advanced mode or when preserveFieldNumbers is set to true
registryWithGeneratedOnce sync.Once
protoRegistryFilesWithGenerated *protoregistry.Files

cacheMu sync.RWMutex // guard fields below
cachedImporters map[string]importer.Importer // absolute file path -> importer
}
Expand Down Expand Up @@ -86,15 +90,32 @@ func NewGeneratorWithOptions(protoPackage, indir, outdir string, opts *options.O
panic(err)
}
gen.ProtoRegistryFiles = registryFiles
registryFiles, err = gen.parseProtoRegistryFiles(true)
if err != nil {
panic(err)
}
gen.ProtoRegistryFilesWithGenerated = registryFiles
gen.ProtoRegistryTypes = dynamicpb.NewTypes(registryFiles)
// NOTE: ProtoRegistryFilesWithGenerated is lazily computed by
// GetProtoRegistryFilesWithGenerated() on first use.
return gen
}

// GetProtoRegistryFilesWithGenerated returns a registry that includes both
// the user-specified imported protos and the previously generated protos
// under outdir. It parses on first call (under sync.Once) and caches the
// result in [Generator.ProtoRegistryFilesWithGenerated]; subsequent calls
// return the cached value. If the field is already set (e.g. by tests),
// it is returned as-is without invoking the parser.
func (gen *Generator) GetProtoRegistryFilesWithGenerated() *protoregistry.Files {
if gen.protoRegistryFilesWithGenerated != nil {
return gen.protoRegistryFilesWithGenerated
}
gen.registryWithGeneratedOnce.Do(func() {
files, err := gen.parseProtoRegistryFiles(true)
if err != nil {
panic(err)
}
gen.protoRegistryFilesWithGenerated = files
})
return gen.protoRegistryFilesWithGenerated
}

func (gen *Generator) parseProtoRegistryFiles(useGeneratedProtos bool) (*protoregistry.Files, error) {
outdir := filepath.Join(gen.OutputDir, gen.OutputOpt.Subdir)
var protoFiles []string
Expand All @@ -117,7 +138,12 @@ func (gen *Generator) preprocess(useGeneratedProtos, delExisted bool) error {
// parse custom imported proto files
protoRegistryFiles := gen.ProtoRegistryFiles
if useGeneratedProtos {
protoRegistryFiles = gen.ProtoRegistryFilesWithGenerated
protoRegistryFiles = gen.GetProtoRegistryFilesWithGenerated()
}
if gen.OutputOpt.PreserveFieldNumbers {
// if preserveFieldNumbers enabled, parse generated protos before they
// are deleted
_ = gen.GetProtoRegistryFilesWithGenerated()
}
gen.typeInfos = xproto.GetAllTypeInfo(protoRegistryFiles, gen.ProtoPackage)
return prepareOutdir(outdir, gen.InputOpt.ProtoFiles, delExisted)
Expand Down
2 changes: 1 addition & 1 deletion internal/tools/generate.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package tools

//go:generate go run cmd/ecode/main.go -config ../localizer/i18n/config/ecode/en.yaml -save ../../xerrors/ecode_generated.go
//go:generate go run cmd/ecode/main.go -config ../localizer/i18n/config/ecode/en.yaml -save ../x/xerrors/ecode_generated.go
Loading
Loading