Shortcode
readfile
Use readfile source="hello.yaml".
contentDir: 'content'
defaultContentLanguage: 'en'
enableMissingTranslationPlaceholders: true
enableGitInfo: true
languages:
en:
disabled: false
languageName: 'English'
languageCode: 'en-US'
weight: 1
title: 'Hugo Template'
ja:
disabled: false
languageName: '日本語'
languageCode: 'ja-JP'
weight: 2
title: 'Hugo Template'
remote-content
Use remote-content url="https://github.com/github/gitignore/raw/refs/heads/main/Rust.gitignore".
# Generated by Cargo
# will have compiled files and executables
debug
target
# These are backup files generated by rustfmt
**/*.rs.bk
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
# Generated by cargo mutants
# Contains mutation testing data
**/mutants.out*/
# RustRover
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
remote-code
remote-code lang="go" opts="" url="https://github.com/google/go-github/raw/refs/heads/master/example/simple/main.go"
// Copyright 2017 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// The simple command demonstrates a simple functionality which
// prompts the user for a GitHub username and lists all the public
// organization memberships of the specified username.
package main
import (
"context"
"fmt"
"github.com/google/go-github/v81/github"
)
// Fetch all the public organizations' membership of a user.
func fetchOrganizations(username string) ([]*github.Organization, error) {
client := github.NewClient(nil)
orgs, _, err := client.Organizations.List(context.Background(), username, nil)
return orgs, err
}
func main() {
var username string
fmt.Print("Enter GitHub username: ")
fmt.Scanf("%s", &username)
organizations, err := fetchOrganizations(username)
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
for i, organization := range organizations {
fmt.Printf("%v. %v\n", i+1, organization.GetLogin())
}
}フィードバック
このページは役に立ちましたか?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.