-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RegisterSchema once per golang package #490
Fixes #490 by only generating one `RegisterSchema()` function per `$Go.package()`. For example, the unit tests persistent-simple.capnp and persistent-samepkg.capnp now both have the annotation: `$Go.package("persistent_simple");` Their generated go code thus starts with: `package persistent_simple` but only one of them will include a `RegisterSchema()`. Note: if `capnp` invokes `capnpc-go` to generate go code but only includes one .capnp file at a time on the command line, this will not detect any *other* .capnp files that might have the same $Go.package. In that situation ask the user to take responsibility for setting `--schemas true` and `--schemas false` for individual invocations of `capnp`. e.g. This will work: `capnpc -o go persistent-simple.capnp persistent-samepkg.capnp` This will not work: `capnpc -o go persistent-simple.capnp; capnpc -o go persistent-samepkg.capnp`
- Loading branch information
1 parent
01cac8d
commit 13494c5
Showing
6 changed files
with
78 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright (c) 2023 Sandstorm Development Group, Inc. and contributors | ||
# Licensed under the MIT License: | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
# THE SOFTWARE. | ||
|
||
using Go = import "/go.capnp"; | ||
|
||
@0x941fad1fe66eeb50; | ||
|
||
$Go.package("persistent_simple"); | ||
$Go.import("capnproto.org/go/capnp/v3/capnpc-go/testdata/persistent-simple"); | ||
|
||
interface SomeOtherFile { | ||
} | ||
|
||
struct ThisIsInTheSamePackageAsTheOtherfile { | ||
string @0 :Text; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.