• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

go-playground / form / 13938478981
100%

Build:
DEFAULT BRANCH: master
Ran 19 Mar 2025 03:50AM UTC
Jobs 1
Files 6
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

19 Mar 2025 03:49AM UTC coverage: 99.815% (+0.001%) from 99.814%
13938478981

push

github

web-flow
Fix panic when the decoding pointer type with custom decoding function (#68)

## Fixes Or Enhances

When a pointer type has a custom decoder and the decoded value is nil,
we get a panic.

Example 

```go
func main() {
	type CustomTime *time.Time
	type TestError struct {
		CT CustomTime
	}
	var test TestError
	decoder = form.NewDecoder()
	decoder.RegisterCustomTypeFunc(func(s []string) (interface{}, error) {
		if s[0] == "" {
			return nil, nil
		}
		parsed, err := time.Parse(time.RFC3339, s[0])
		if err != nil {
			return nil, err
		}
		return CustomTime(&parsed), nil
	}, CustomTime(nil))

	values := url.Values{
		"CT": []string{""},
	}
	decoder.Decode(&test, values)
}
```

```
panic: reflect: call of reflect.Value.Set on zero Value
```

This PR specifically handles the case for the case when the type is a
pointer.

**Make sure that you've checked the boxes below before you submit PR:**
- [x] Tests exist or have been written that cover this particular
change.

@go-playground/admins

8 of 8 new or added lines in 1 file covered. (100.0%)

1082 of 1084 relevant lines covered (99.82%)

109.04 hits per line

Jobs
ID Job ID Ran Files Coverage
1 13938478981.1 19 Mar 2025 03:50AM UTC 6
99.82
GitHub Action Run
Source Files on build 13938478981
  • Tree
  • List 6
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 212b1c48 on github
  • Prev Build on master (#5545626869)
  • Next Build on master (#13938521593)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc