Skip to content

Conversation

@fcuenca4
Copy link

@fcuenca4 fcuenca4 commented Jan 5, 2026

Note

Introduces internal wrapping and refines header APIs; removes a dependency and adds tests.

  • Replace go-textwrapper with custom lineWrapper in encoding.go for base64 and 7bit/8bit line folding; update tests (encoding_test.go) and add comprehensive lineWrapper cases
  • Fix Entity.WriteTo to close writer only after successful body write and propagate errors
  • Seal interfaces with unexported methods: message.HeaderFields, mail.PartHeader, and textproto.HeaderFields; implement in mail/InlineHeader and mail/AttachmentHeader
  • Mail header tweaks: Header.Date() returns zero time if missing; SetDate/SetMessageID delete field when zero/empty; minor Message-ID parse flow fix
  • Charset: add alias x-utf_8j → UTF-8
  • Textproto: correct AddRaw doc (colon), minor comment formatting
  • Add writer round-trip test to preserve original formatting after read (writer_test.go)
  • CI/docs/deps: switch build image to alpine/latest, add gofmt task; update README badge to pkg.go.dev; remove go-textwrapper and bump golang.org/x/text to v0.14.0

Written by Cursor Bugbot for commit b9039e0. This will update automatically on new commits. Configure here.

emersion and others added 26 commits February 13, 2023 14:06
Introduced by mistake in the previous commit:

    ./multipart.go:103:3: h declared and not used
The GitHub UI already displays that information.
As-is, extending PartHeader is a breaking change, and we only want
to allow two variants.
Without the recent change of line wrapper implementation, this test is
failing. There seem to be line breaks inserted in the middle of the
body:

```diff
--- /tmp/go-message-orig-194495186.txt
+++ /tmp/go-message-after-83245617.txt
@@ -37,7 +37,8 @@
  	if c.editor == nil {
  		return
  	}
-@@ -1205,7 +1213,7 @@ func (c *Composer) termClosed(err error) {
+@@ -1205,7 +1
+213,7 @@ func (c *Composer) termClosed(err error) {
  		PushError("Failed to reopen email file: " + e.Error())
  	}
  	editor := c.editor
@@ -70,7 +71,8 @@
 +					PushError(err.Error())
 +				})
  			}
- 			return
+ 			return
+
  		}
 --
 2.47.1
```

References: c2ff70fd20da09d40ba
References: 6a718fa6214f9f35d33
Signed-off-by: Robin Jarry <robin@jarry.cc>
The doc incorrectly stated that the method requires the argument to have a comma character. Instead, it requires a colon.
@fcuenca4 fcuenca4 marked this pull request as draft January 5, 2026 14:13
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.

7 participants