gophers

Gopher artwork (Golang mascot) (by scraly)

Gophers Alternatives

Similar projects and alternatives to gophers

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better gophers alternative or higher similarity.

gophers reviews and mentions

Posts with mentions or reviews of gophers. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-09-13.
  • Rust cli example #2: Ferris hunts errors
    3 projects | dev.to | 13 Sep 2021
    fn get_gopher(gopher: String) -> Result { println!("Try to get {} Gopher...", gopher); let url = format!("https://github.com/scraly/gophers/raw/main/{}.png", gopher); let response = minreq::get(url) .send() .expect("Fail to get response from server"); if response.status_code == 200 { let file_name = format!("{}.png", gopher); let mut output_file = File::create(&file_name).expect("Fail to create file"); output_file .write_all(response.as_bytes()) .expect("Fail to write file"); Ok(format!("Perfect! Just saved in {}", &file_name)) } else { Err(Error::GopherNotFound(format!( "Gopher {} not exists", gopher ))) } }
  • Rust cli example: Ferris fetches Go gopher postcards
    3 projects | dev.to | 9 Aug 2021
    use std::fs::File; use std::io::stdout; use std::io::Write; use structopt::clap::{crate_name, crate_version, Shell}; use structopt::StructOpt; #[derive(StructOpt, Debug)] #[structopt(name = "rust-gopher-friend-cli", version = crate_version!(), about = "Gopher CLI application written in Rust.")] enum Command { /// This command will get the desired Gopher Get { /// Gopher type #[structopt()] gopher: String, }, /// Generate completion script Completion { /// Shell type #[structopt(possible_values = &["bash", "fish", "zsh", "powershell", "elvish"])] shell: Shell, }, } fn get_gopher(gopher: String) { println!("Try to get {} Gopher...", gopher); let url = format!("https://github.com/scraly/gophers/raw/main/{}.png", gopher); let response = minreq::get(url) .send() .expect("Fail to get response from server"); if response.status_code == 200 { let file_name = format!("{}.png", gopher); let mut output_file = File::create(&file_name).expect("Fail to create file"); output_file .write_all(response.as_bytes()) .expect("Fail to write file"); println!("Perfect! Just saved in {}", &file_name); } else { eprintln!("Gopher {} not exists", gopher); } } fn main() { let cmd = Command::from_args(); match cmd { Command::Get { gopher } => get_gopher(gopher), Command::Completion { shell } => { Command::clap().gen_completions_to(crate_name!(), shell, &mut stdout()) } } }
  • Learning Go by examples: part 3 - Create a CLI app in Go
    3 projects | dev.to | 27 Jul 2021
    var getCmd = &cobra.Command{ Use: "get", Short: "This command will get the desired Gopher", Long: `This get command will call GitHub respository in order to return the desired Gopher.`, Run: func(cmd *cobra.Command, args []string) { var gopherName = "dr-who.png" if len(args) >= 1 && args[0] != "" { gopherName = args[0] } URL := "https://github.com/scraly/gophers/raw/main/" + gopherName + ".png" fmt.Println("Try to get '" + gopherName + "' Gopher...") // Get the data response, err := http.Get(URL) if err != nil { fmt.Println(err) } defer response.Body.Close() if response.StatusCode == 200 { // Create the file out, err := os.Create(gopherName + ".png") if err != nil { fmt.Println(err) } defer out.Close() // Writer the body to file _, err = io.Copy(out, response.Body) if err != nil { fmt.Println(err) } fmt.Println("Perfect! Just saved in " + out.Name() + "!") } else { fmt.Println("Error: " + gopherName + " not exists! :-(") } }, }
  • Learning Go by examples: part 2 - Create an HTTP REST API Server in Go
    6 projects | dev.to | 20 Jul 2021
    package main import ( "fmt" "log" "net/http" "github.com/go-openapi/loads" "github.com/go-openapi/runtime/middleware" "github.com/scraly/learning-go-by-examples/go-rest-api/pkg/swagger/server/restapi" "github.com/scraly/learning-go-by-examples/go-rest-api/pkg/swagger/server/restapi/operations" ) func main() { // Initialize Swagger swaggerSpec, err := loads.Analyzed(restapi.SwaggerJSON, "") if err != nil { log.Fatalln(err) } api := operations.NewHelloAPIAPI(swaggerSpec) server := restapi.NewServer(api) defer func() { if err := server.Shutdown(); err != nil { // error handle log.Fatalln(err) } }() server.Port = 8080 api.CheckHealthHandler = operations.CheckHealthHandlerFunc(Health) api.GetHelloUserHandler = operations.GetHelloUserHandlerFunc(GetHelloUser) api.GetGopherNameHandler = operations.GetGopherNameHandlerFunc(GetGopherByName) // Start server which listening if err := server.Serve(); err != nil { log.Fatalln(err) } } //Health route returns OK func Health(operations.CheckHealthParams) middleware.Responder { return operations.NewCheckHealthOK().WithPayload("OK") } //GetHelloUser returns Hello + your name func GetHelloUser(user operations.GetHelloUserParams) middleware.Responder { return operations.NewGetHelloUserOK().WithPayload("Hello " + user.User + "!") } //GetGopherByName returns a gopher in png func GetGopherByName(gopher operations.GetGopherNameParams) middleware.Responder { var URL string if gopher.Name != "" { URL = "https://github.com/scraly/gophers/raw/main/" + gopher.Name + ".png" } else { //by default we return dr who gopher URL = "https://github.com/scraly/gophers/raw/main/dr-who.png" } response, err := http.Get(URL) if err != nil { fmt.Println("error") } return operations.NewGetGopherNameOK().WithPayload(response.Body) }
  • A note from our sponsor - SaaSHub
    www.saashub.com | 2 May 2024
    SaaSHub helps you find the best software and product alternatives Learn more →

Stats

Basic gophers repo stats
4
30
3.7
about 1 month ago

scraly/gophers is an open source project licensed under GNU General Public License v3.0 or later which is an OSI approved license.


Sponsored
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com