-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ada-url/update-readme
refactor: small touches to readme and files
- Loading branch information
Showing
4 changed files
with
104 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
BASE_DIR=$(pwd) | ||
DEPENDENCIES_DIR="$BASE_DIR" | ||
|
||
WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') | ||
|
||
cleanup () { | ||
EXIT_CODE=$? | ||
[ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE" | ||
exit $EXIT_CODE | ||
} | ||
|
||
trap cleanup INT TERM EXIT | ||
|
||
cd "$WORKSPACE" | ||
curl -sL -o "ada" "https://github.com/ada-url/ada/releases/latest/download/singleheader.zip" | ||
unzip ada | ||
rm ada | ||
cp * "$DEPENDENCIES_DIR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: macOS | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
paths-ignore: | ||
- '**.md' | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- '**.md' | ||
|
||
permissions: | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
go-version: [1.20.x] | ||
platform: [macos-latest] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Test | ||
run: go test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,40 @@ | ||
# goada: Fast WHATWG URL library in Go | ||
[![Go-CI](https://github.com/ada-url/goada/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/ada-url/goada/actions/workflows/ubuntu.yml) | ||
[![GoDoc](https://godoc.org/github.com/ada-url/goada?status.svg)](https://godoc.org/github.com/ada-url/goada) | ||
|
||
# goada : fast WHATGL URL library in Go | ||
[![Go-CI](https://github.com/ada-url/goada/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/ada-url/goada/actions/workflows/ubuntu.yml) [![GoDoc](https://godoc.org/github.com/ada-url/goada?status.svg)](https://godoc.org/github.com/ada-url/goada) | ||
The goada library provides support for the WHATWG URL standard in Go. | ||
|
||
The goada library provides support for the WHATGL URL | ||
standard in Go. | ||
## Requirements | ||
|
||
- Go 1.20 or better. | ||
|
||
Examples: | ||
|
||
### Examples | ||
|
||
```Go | ||
url, nil := New("https:// www.GOoglé.com") | ||
fmt.Println(url.Href()) // "https://www.xn--googl-fsa.com/" | ||
url, nil := New("https:// www.GOoglé.com") | ||
fmt.Println(url.Href()) // "https://www.xn--googl-fsa.com/" | ||
``` | ||
|
||
The standard `net/url` `Parse` function would refuse to parse the URL `"https:// www.GOoglé.com"` because it contains a tabulation character. Even if we remove the tabulation character, it would still parse it to an incorrect string as per the WHATGL URL standard (`https://www.GOogl%C3%A9.com`). | ||
|
||
## Requirements | ||
|
||
- Go 1.20 or better. | ||
The standard `net/url` `Parse` function would refuse to parse the URL `"https:// www.GOoglé.com"` because it | ||
contains a tabulation character. Even if we remove the tabulation character, it would still parse it to an incorrect | ||
string as per the WHATGL URL standard (`https://www.GOogl%C3%A9.com`). | ||
|
||
## Usage | ||
### Usage | ||
|
||
```Go | ||
import ( | ||
"github.com/ada-url/goada" | ||
"fmt" | ||
) | ||
|
||
url, err := goada.New("https://www.GOogle.com") | ||
if err != nil { | ||
t.Error("Expected no error") | ||
} | ||
fmt.Println(url.Href()) // prints https://www.google.com/ | ||
url.SetProtocol("http:") | ||
url.SetHash("goada") | ||
fmt.Println(url.Hash()) // prints #goada | ||
fmt.Println(url.Href()) // prints http://www.google.com/#goada | ||
import ( | ||
"github.com/ada-url/goada" | ||
"fmt" | ||
) | ||
|
||
url, err := goada.New("https://www.GOogle.com") | ||
if err != nil { | ||
t.Error("Expected no error") | ||
} | ||
fmt.Println(url.Href()) // prints https://www.google.com/ | ||
url.SetProtocol("http:") | ||
url.SetHash("goada") | ||
fmt.Println(url.Hash()) // prints #goada | ||
fmt.Println(url.Href()) // prints http://www.google.com/#goada | ||
``` |