Skip to content

Conversation

@silviogutierrez
Copy link
Contributor

@silviogutierrez silviogutierrez commented Feb 1, 2026

Summary

Add Encoder.OmitEmpty(bool) method to treat all struct fields as if tagged with omitempty.

This implements the first item from the "Future Work" section in the README.

Usage

form.NewEncoder(w).OmitEmpty(true).Encode(value)

Dependencies

This PR depends on #30 (Modernize for Go 1.21+ and add GitHub Actions CI) and should be merged after it.

Test plan

  • All existing tests pass
  • New TestEncode_OmitEmpty test covers the feature
  • go vet passes
  • gofmt check passes

🤖 Generated with Claude Code

silviogutierrez and others added 6 commits February 1, 2026 21:49
- Add go.mod for module support
- Add shell.nix for Nix-based development environment
- Replace deprecated ioutil.ReadAll with io.ReadAll
- Fix tests to use & instead of ; as query separator (Go 1.17+ security fix)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Runs build, test, and vet using Nix shell environment.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Uses commit 8c5066250910 instead of channel for deterministic builds.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fails the build if any files are not properly formatted.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Travis CI is no longer active. Update badge to GitHub Actions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add Encoder.OmitEmpty(bool) method that treats all struct fields as if
they had the omitempty tag. This implements the first item from the
Future Work section.

Usage:
    form.NewEncoder(w).OmitEmpty(true).Encode(value)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@silviogutierrez silviogutierrez force-pushed the add-omitempty-modern-go branch from 17877a4 to 1b82dad Compare February 1, 2026 21:56
@silviogutierrez silviogutierrez changed the title Add OmitEmpty and modern Go support Add OmitEmpty option to Encoder Feb 1, 2026
@ajg ajg merged commit 75d905a into ajg:master Feb 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants