Skip to content

Upgrade Guide

Upgrading from v4 to v5 is the most easier upgrade yet. The only breaking change that was introduced is "Raw string output" syntax. Previously, in order to get unescaped string output you needed to use raw function on strings like this:

textwire
{{ "<h1>Test</h1>".raw() }}

In Textwire v5, raw function was removed. In order to print raw output you now need to use this syntax:

textwire
{!! "<h1>Test</h1>" !!}

We did it because raw function was causing a lot of issues where a string could be escaped multiple times causing the wrong output.

Steps

1. Update Import Path

Replace all v4 imports with v5:

go
import "github.com/textwire/textwire/v4"
import "github.com/textwire/textwire/v5"

After updating imports, run:

bash
go mod tidy

2. Replace raw Function

If you use raw function in your code, replace it's usage with new syntax:

textwire
{{ post.description.raw() }}
{!! post.description !!}