github gitlab twitter
Announcing turtle - Emojis for Go
Sep 19, 2017
2 minutes read

Emojis for Go 😄 🐢 🚀

turtle is a Go library that provides a nice API to look up emojis either by name identifier, category, or keywords. Distributed under the terms of the MIT license, turtle is free and open source software. The project also comes with a CLI app for using turtle from the command-line. 😄 🐢 💻

For more information check out the turtle project on GitHub.

If you find it any useful, I’d love to hear from you via twitter! 😃

Installation

Library

To install the turtle library run:

go get github.com/hackebrot/turtle

CLI app

If you would also like to use the turtle CLI app run:

go get github.com/hackebrot/turtle/cmd/turtle

Usage

Library

turtle.Emojis is a map which contains all emojis available in turtle. You can use it to look up emoji by their name.

For the other search functions please check out the turtle reference.

package main

import (
	"fmt"
	"os"

	"github.com/hackebrot/turtle"
)

func main() {
	name := "turtle"
	emoji, ok := turtle.Emojis[name]

	if !ok {
		fmt.Fprintf(os.Stderr, "no emoji found for name: %v\n", name)
		os.Exit(1)
	}

	fmt.Printf("Name: %q\n", emoji.Name)
	fmt.Printf("Char: %s\n", emoji.Char)
	fmt.Printf("Category: %q\n", emoji.Category)
	fmt.Printf("Keywords: %q\n", emoji.Keywords)
}
Name: "turtle"
Char: 🐢
Category: "animals_and_nature"
Keywords: ["animal" "slow" "nature" "tortoise"]

Issues

If you encounter any problems, please file an issue along with a detailed description.

Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. 👍


Back to posts