Question: Why not use indirect for map
Open
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 4k
- Forks
- 337
- Avg merge
- 15m
- Merged PRs (30d)
- 1
Description
package main
import (
"fmt"
"github.com/spf13/cast"
)
func main() {
a := map[string]string{"hello": "123"}
r := cast.ToStringMapInt(a)
fmt.Printf("%T %#v\n", r, r)
r = cast.ToStringMapInt(&a)
fmt.Printf("%T %#v\n", r, r)
}
//OUTPUT:
//map[string]int map[string]int{"hello":123}
//map[string]int map[string]int{}
If ToStringMapInt does indirect as well, then the ToStringMapInt method will have a friendlier result.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the ToStringMapInt entry point and inspect how it handles a map pointer compared with a map value. Check the existing conversion behavior for both examples; done means pointer input produces the same converted map result as direct map input, with coverage for the intended behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100