A summary of the official Microsoft C# coding conventions, based on Microsoft’s documentation.
- PascalCase for class, property, method, and namespace names
public class MyExampleClass { }
| // Client sends requests to an OpenAI-compatible chat-completions endpoint. | |
| type Client struct { | |
| cfg *configuration.AppConfig | |
| httpClient *http.Client | |
| } | |
| // NewClient creates a new LLM client with the given configuration. | |
| func NewClient(cfg *configuration.AppConfig) *Client { | |
| return &Client{ | |
| cfg: cfg, |
| package templating | |
| import ( | |
| "encoding/base64" | |
| "net/http" | |
| "time" | |
| "reload-helper/internal/global" | |
| ) |
| func loadEnvVars(filename string) { | |
| file, err := os.Open(filename) | |
| if err != nil { | |
| log.Fatalf("failed to open env file: %v", err) | |
| } | |
| defer file.Close() | |
| scanner := bufio.NewScanner(file) | |
| for scanner.Scan() { | |
| line := strings.TrimSpace(scanner.Text()) |
A summary of the official Microsoft C# coding conventions, based on Microsoft’s documentation.
public class MyExampleClass { }| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "log" | |
| "net/url" | |
| "strings" | |
| ) |
Please observe the difference in speed when calling resp.Body.Close().
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "strconv" | |
| ) | |
| var ( | |
| paragraphs = []string{ |
| using Org.BouncyCastle.Crypto; | |
| using Org.BouncyCastle.Crypto.Encodings; | |
| using Org.BouncyCastle.Crypto.Engines; | |
| using Org.BouncyCastle.Crypto.Generators; | |
| using Org.BouncyCastle.OpenSsl; | |
| using Org.BouncyCastle.Security; | |
| using System.Text; | |
| namespace RSATest |
| [Unit] | |
| Description=CertMaker Bot (to cover your cert needs) | |
| After=network.target | |
| [Service] | |
| Type=simple | |
| ExecStart=/home/certmaker-bot/bin/certmaker-bot | |
| WorkingDirectory=/home/certmaker-bot/bin | |
| User=certmaker-bot | |
| Group=certmaker-bot |