diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 2aea4d6..3de9fb6 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,4 +2,3 @@ github: imdario ko_fi: dariocc -custom: https://beerpay.io/imdario/mergo diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..e0871f9 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "gomod" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..239bb4e --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,72 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + schedule: + - cron: '43 19 * * 2' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/stackaid.yml b/.github/workflows/stackaid.yml new file mode 100644 index 0000000..c32b66b --- /dev/null +++ b/.github/workflows/stackaid.yml @@ -0,0 +1,12 @@ +name: 'fund-on-stackaid' +on: + push: + branches: + - master +jobs: + stackaid-json: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v3 # Only required for Go based repos + - uses: stackaid/generate-stackaid-json@v1.9 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..0a1ff9f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,112 @@ + +# Contributing to mergo + +First off, thanks for taking the time to contribute! â¤ī¸ + +All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉 + +> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: +> - Star the project +> - Tweet about it +> - Refer this project in your project's readme +> - Mention the project at local meetups and tell your friends/colleagues + + +## Table of Contents + +- [Code of Conduct](#code-of-conduct) +- [I Have a Question](#i-have-a-question) +- [I Want To Contribute](#i-want-to-contribute) +- [Reporting Bugs](#reporting-bugs) +- [Suggesting Enhancements](#suggesting-enhancements) + +## Code of Conduct + +This project and everyone participating in it is governed by the +[mergo Code of Conduct](https://github.com/imdario/mergoblob/master/CODE_OF_CONDUCT.md). +By participating, you are expected to uphold this code. Please report unacceptable behavior +to <>. + + +## I Have a Question + +> If you want to ask a question, we assume that you have read the available [Documentation](https://pkg.go.dev/github.com/imdario/mergo). + +Before you ask a question, it is best to search for existing [Issues](https://github.com/imdario/mergo/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. + +If you then still feel the need to ask a question and need clarification, we recommend the following: + +- Open an [Issue](https://github.com/imdario/mergo/issues/new). +- Provide as much context as you can about what you're running into. +- Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant. + +We will then take care of the issue as soon as possible. + +## I Want To Contribute + +> ### Legal Notice +> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license. + +### Reporting Bugs + + +#### Before Submitting a Bug Report + +A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. + +- Make sure that you are using the latest version. +- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](). If you are looking for support, you might want to check [this section](#i-have-a-question)). +- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/imdario/mergoissues?q=label%3Abug). +- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. +- Collect information about the bug: +- Stack trace (Traceback) +- OS, Platform and Version (Windows, Linux, macOS, x86, ARM) +- Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant. +- Possibly your input and the output +- Can you reliably reproduce the issue? And can you also reproduce it with older versions? + + +#### How Do I Submit a Good Bug Report? + +> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to . + + +We use GitHub issues to track bugs and errors. If you run into an issue with the project: + +- Open an [Issue](https://github.com/imdario/mergo/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.) +- Explain the behavior you would expect and the actual behavior. +- Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. +- Provide the information you collected in the previous section. + +Once it's filed: + +- The project team will label the issue accordingly. +- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced. +- If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be implemented by someone. + +### Suggesting Enhancements + +This section guides you through submitting an enhancement suggestion for mergo, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. + + +#### Before Submitting an Enhancement + +- Make sure that you are using the latest version. +- Read the [documentation]() carefully and find out if the functionality is already covered, maybe by an individual configuration. +- Perform a [search](https://github.com/imdario/mergo/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. +- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library. + + +#### How Do I Submit a Good Enhancement Suggestion? + +Enhancement suggestions are tracked as [GitHub issues](https://github.com/imdario/mergo/issues). + +- Use a **clear and descriptive title** for the issue to identify the suggestion. +- Provide a **step-by-step description of the suggested enhancement** in as many details as possible. +- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. +- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux. +- **Explain why this enhancement would be useful** to most mergo users. You may also want to point out the other projects that solved it better and which could serve as inspiration. + + +## Attribution +This guide is based on the **contributing-gen**. [Make your own](https://github.com/bttger/contributing-gen)! diff --git a/README.md b/README.md index 7e6f7ae..4f02874 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # Mergo - [![GoDoc][3]][4] [![GitHub release][5]][6] [![GoCard][7]][8] @@ -9,6 +8,7 @@ [![Sourcegraph][11]][12] [![FOSSA Status][13]][14] [![Become my sponsor][15]][16] +[![Tidelift][17]][18] [1]: https://travis-ci.org/imdario/mergo.png [2]: https://travis-ci.org/imdario/mergo @@ -26,6 +26,8 @@ [14]: https://app.fossa.io/projects/git%2Bgithub.com%2Fimdario%2Fmergo?ref=badge_shield [15]: https://img.shields.io/github/sponsors/imdario [16]: https://github.com/sponsors/imdario +[17]: https://tidelift.com/badges/package/go/github.com%2Fimdario%2Fmergo +[18]: https://tidelift.com/subscription/pkg/go-github.com-imdario-mergo A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements. @@ -55,7 +57,6 @@ If Mergo is useful to you, consider buying me a coffee, a beer, or making a mont ### Mergo in the wild -- [cli/cli](https://github.com/cli/cli) - [moby/moby](https://github.com/moby/moby) - [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) - [vmware/dispatch](https://github.com/vmware/dispatch) diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..a5de61f --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,14 @@ +# Security Policy + +## Supported Versions + +| Version | Supported | +| ------- | ------------------ | +| 0.3.x | :white_check_mark: | +| < 0.3 | :x: | + +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. diff --git a/go.mod b/go.mod index 6f476d6..4cc3d51 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/imdario/mergo go 1.13 -require gopkg.in/yaml.v3 v3.0.0 +require gopkg.in/yaml.v3 v3.0.1 diff --git a/go.sum b/go.sum index 223abcb..a62c313 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,4 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/issue123_test.go b/issue123_test.go index ae62d7b..9a9e4d8 100644 --- a/issue123_test.go +++ b/issue123_test.go @@ -23,20 +23,20 @@ func TestIssue123(t *testing.T) { t.Fatal(err) } testCases := []struct { - key string expected interface{} + key string }{ { - "col1", nil, + "col1", }, { - "col2", 4, + "col2", }, { - "col3", nil, + "col3", }, } for _, tC := range testCases { diff --git a/issue136_test.go b/issue136_test.go index 4fe81c7..0246ec9 100644 --- a/issue136_test.go +++ b/issue136_test.go @@ -12,8 +12,8 @@ type embeddedTestA struct { } type embeddedTestB struct { - embeddedTestA Address string + embeddedTestA } func TestMergeEmbedded(t *testing.T) { diff --git a/issue143_test.go b/issue143_test.go index 8cca4d8..0ea9306 100644 --- a/issue143_test.go +++ b/issue143_test.go @@ -9,8 +9,8 @@ import ( func TestIssue143(t *testing.T) { testCases := []struct { - options []func(*mergo.Config) expected func(map[string]interface{}) error + options []func(*mergo.Config) }{ { options: []func(*mergo.Config){mergo.WithOverride}, diff --git a/issue230_test.go b/issue230_test.go new file mode 100644 index 0000000..129f037 --- /dev/null +++ b/issue230_test.go @@ -0,0 +1,85 @@ +package mergo_test + +import ( + "testing" + + "github.com/imdario/mergo" +) + +var testDataM = []struct { + M1 mapTest + M2 mapTest + WithOverrideEmptyValue bool + ExpectedMap map[int]int +}{ + { + M1: mapTest{ + M: map[int]int{1: 1, 3: 3}, + }, + M2: mapTest{ + M: map[int]int{1: 2, 2: 2}, + }, + WithOverrideEmptyValue: true, + ExpectedMap: map[int]int{1: 1, 3: 3}, + }, + { + M1: mapTest{ + M: map[int]int{1: 1, 3: 3}, + }, + M2: mapTest{ + M: map[int]int{1: 2, 2: 2}, + }, + WithOverrideEmptyValue: false, + ExpectedMap: map[int]int{1: 1, 2: 2, 3: 3}, + }, + { + M1: mapTest{ + M: map[int]int{}, + }, + M2: mapTest{ + M: map[int]int{1: 2, 2: 2}, + }, + WithOverrideEmptyValue: true, + ExpectedMap: map[int]int{}, + }, + { + M1: mapTest{ + M: map[int]int{}, + }, + M2: mapTest{ + M: map[int]int{1: 2, 2: 2}, + }, + WithOverrideEmptyValue: false, + ExpectedMap: map[int]int{1: 2, 2: 2}, + }, +} + +func withOverrideEmptyValue(enable bool) func(*mergo.Config) { + if enable { + return mergo.WithOverwriteWithEmptyValue + } + + return mergo.WithOverride +} + +func TestMergeMapWithOverride(t *testing.T) { + t.Parallel() + + for _, data := range testDataM { + err := mergo.Merge(&data.M2, data.M1, withOverrideEmptyValue(data.WithOverrideEmptyValue)) + if err != nil { + t.Errorf("Error while merging %s", err) + } + + if len(data.M2.M) != len(data.ExpectedMap) { + t.Errorf("Got %d elements in map, but expected %d", len(data.M2.M), len(data.ExpectedMap)) + return + } + + for i, val := range data.M2.M { + if val != data.ExpectedMap[i] { + t.Errorf("Expected value: %d, but got %d while merging map", data.ExpectedMap[i], val) + } + } + } +} diff --git a/issue89_test.go b/issue89_test.go index 0a38994..1e138a9 100644 --- a/issue89_test.go +++ b/issue89_test.go @@ -33,20 +33,16 @@ func TestIssue89MergeWithEmptyValue(t *testing.T) { t.Error(err) } testCases := []struct { - key string expected interface{} + key string }{ { - "A", - 3, - }, - { - "B", "", + "B", }, { - "C", false, + "C", }, } for _, tC := range testCases { diff --git a/issue90_test.go b/issue90_test.go index 872a327..cb97537 100644 --- a/issue90_test.go +++ b/issue90_test.go @@ -10,11 +10,10 @@ type structWithStringMap struct { Data map[string]string } - func TestIssue90(t *testing.T) { - dst := map[string]structWithStringMap{ - "struct": { - Data: nil, + dst := map[string]structWithStringMap{ + "struct": { + Data: nil, }, } src := map[string]structWithStringMap{ diff --git a/map.go b/map.go index a13a7ee..f739255 100644 --- a/map.go +++ b/map.go @@ -44,7 +44,7 @@ func deepMap(dst, src reflect.Value, visited map[uintptr]*visit, depth int, conf } } // Remember, remember... - visited[h] = &visit{addr, typ, seen} + visited[h] = &visit{typ, seen, addr} } zeroValue := reflect.Value{} switch dst.Kind() { diff --git a/merge.go b/merge.go index 8b4e2f4..1bf26cf 100644 --- a/merge.go +++ b/merge.go @@ -38,10 +38,10 @@ func isExportedComponent(field *reflect.StructField) bool { } type Config struct { + Transformers Transformers Overwrite bool AppendSlice bool TypeCheck bool - Transformers Transformers overwriteWithEmptyValue bool overwriteSliceWithEmptyValue bool sliceDeepCopy bool @@ -76,7 +76,7 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co } } // Remember, remember... - visited[h] = &visit{addr, typ, seen} + visited[h] = &visit{typ, seen, addr} } if config.Transformers != nil && !isReflectNil(dst) && dst.IsValid() { @@ -205,6 +205,16 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co dst.SetMapIndex(key, srcElement) } } + + // Ensure that all keys in dst are deleted if they are not in src. + if overwriteWithEmptySrc { + for _, key := range dst.MapKeys() { + srcElement := src.MapIndex(key) + if !srcElement.IsValid() { + dst.SetMapIndex(key, reflect.Value{}) + } + } + } case reflect.Slice: if !dst.CanSet() { break diff --git a/merge_test.go b/merge_test.go index dd51dab..b87e23a 100644 --- a/merge_test.go +++ b/merge_test.go @@ -19,13 +19,13 @@ func (s *transformer) Transformer(t reflect.Type) func(dst, src reflect.Value) e } type foo struct { - s string Bar *bar + s string } type bar struct { - i int s map[string]string + i int } func TestMergeWithTransformerNilStruct(t *testing.T) { diff --git a/mergo.go b/mergo.go index 9fe362d..d2af2a9 100644 --- a/mergo.go +++ b/mergo.go @@ -28,9 +28,9 @@ var ( // checks in progress are true when it reencounters them. // Visited are stored in a map indexed by 17 * a1 + a2; type visit struct { - ptr uintptr typ reflect.Type next *visit + ptr uintptr } // From src/pkg/encoding/json/encode.go. diff --git a/mergo_test.go b/mergo_test.go index 6b3eba7..5e37d04 100644 --- a/mergo_test.go +++ b/mergo_test.go @@ -21,9 +21,9 @@ type simpleTest struct { } type complexTest struct { + ID string St simpleTest sz int - ID string } type mapTest struct { @@ -50,8 +50,8 @@ type sliceTest struct { func TestKb(t *testing.T) { type testStruct struct { - Name string KeyValue map[string]interface{} + Name string } akv := make(map[string]interface{}) @@ -116,7 +116,7 @@ func TestSimpleStruct(t *testing.T) { func TestComplexStruct(t *testing.T) { a := complexTest{} a.ID = "athing" - b := complexTest{simpleTest{42}, 1, "bthing"} + b := complexTest{"bthing", simpleTest{42}, 1} if err := mergo.Merge(&a, b); err != nil { t.FailNow() } @@ -132,10 +132,10 @@ func TestComplexStruct(t *testing.T) { } func TestComplexStructWithOverwrite(t *testing.T) { - a := complexTest{simpleTest{1}, 1, "do-not-overwrite-with-empty-value"} - b := complexTest{simpleTest{42}, 2, ""} + a := complexTest{"do-not-overwrite-with-empty-value", simpleTest{1}, 1} + b := complexTest{"", simpleTest{42}, 2} - expect := complexTest{simpleTest{42}, 1, "do-not-overwrite-with-empty-value"} + expect := complexTest{"do-not-overwrite-with-empty-value", simpleTest{42}, 1} if err := mergo.MergeWithOverwrite(&a, b); err != nil { t.FailNow() } @@ -417,22 +417,22 @@ func TestMergeUsingStructAndMap(t *testing.T) { Msg2 string } type params struct { - Name string Multi *multiPtr Final *final + Name string } type config struct { + Params *params Foo string Bar string - Params *params } cases := []struct { - name string - overwrite bool changes *config target *config output *config + name string + overwrite bool }{ { name: "Should overwrite values in target for non-nil values in source", @@ -721,13 +721,13 @@ func TestIfcMapWithOverwrite(t *testing.T) { } type pointerMapTest struct { + B *simpleTest A int hidden int - B *simpleTest } func TestBackAndForth(t *testing.T) { - pt := pointerMapTest{42, 1, &simpleTest{66}} + pt := pointerMapTest{&simpleTest{66}, 42, 1} m := make(map[string]interface{}) if err := mergo.Map(&m, pt); err != nil { t.FailNow() @@ -763,8 +763,8 @@ func TestBackAndForth(t *testing.T) { func TestEmbeddedPointerUnpacking(t *testing.T) { tests := []struct{ input pointerMapTest }{ - {pointerMapTest{42, 1, nil}}, - {pointerMapTest{42, 1, &simpleTest{66}}}, + {pointerMapTest{nil, 42, 1}}, + {pointerMapTest{&simpleTest{66}, 42, 1}}, } newValue := 77 m := map[string]interface{}{ @@ -900,18 +900,18 @@ func TestBooleanPointer(t *testing.T) { func TestMergeMapWithInnerSliceOfDifferentType(t *testing.T) { testCases := []struct { name string - options []func(*mergo.Config) err string + options []func(*mergo.Config) }{ { "With override and append slice", - []func(*mergo.Config){mergo.WithOverride, mergo.WithAppendSlice}, "cannot append two slices with different type", + []func(*mergo.Config){mergo.WithOverride, mergo.WithAppendSlice}, }, { "With override and type check", - []func(*mergo.Config){mergo.WithOverride, mergo.WithTypeCheck}, "cannot override two slices with different type", + []func(*mergo.Config){mergo.WithOverride, mergo.WithTypeCheck}, }, } for _, tc := range testCases { diff --git a/v039_bugs_test.go b/v039_bugs_test.go index c470ed0..16a8cc0 100644 --- a/v039_bugs_test.go +++ b/v039_bugs_test.go @@ -53,8 +53,8 @@ func TestV039Issue152(t *testing.T) { } type issue146Foo struct { - A string B map[string]issue146Bar + A string } type issue146Bar struct {