Skip to content

Instantly share code, notes, and snippets.

View yakuter's full-sized avatar
💭
Working #golang @binalyze

Erhan Yakut yakuter

💭
Working #golang @binalyze
View GitHub Profile
@yakuter
yakuter / Test_exit_fatal_panic_3.go
Created December 5, 2024 06:23
Testing Exit, Fatal, and Panic in Golang 3/3
package main
import (
"testing"
)
func TestPanic(t *testing.T) {
defer func() {
r := recover()
if r == nil {
@yakuter
yakuter / Test_exit_fatal_panic_2.go
Last active December 5, 2024 06:23
Testing Exit, Fatal, and Panic in Golang 2/3
package main
import (
"bytes"
"log"
"os"
"testing"
)
func TestLogFatal(t *testing.T) {
@yakuter
yakuter / Test_exit_fatal_panic_1.go
Last active December 5, 2024 06:22
Testing Exit, Fatal, and Panic in Golang 1/3
package main
import (
"bytes"
"fmt"
"os"
"testing"
)
func TestExit(t *testing.T) {
@yakuter
yakuter / test_stdout.go
Created December 5, 2024 06:07
StdoutTest
package main
import (
"bytes"
"fmt"
"io"
"os"
"testing"
)
@yakuter
yakuter / ioReaderRight.go
Created February 15, 2024 21:02
Copy and Movement 11
package main
import (
"fmt"
"io"
"strings"
)
func main() {
reader := strings.NewReader("This is a test message.")
@yakuter
yakuter / ioReaderWrong.go
Created February 15, 2024 20:56
Copy and Movement 10
package main
import (
"fmt"
"io"
"strings"
)
func main() {
reader := strings.NewReader("Test")
@yakuter
yakuter / bufio.go
Created February 15, 2024 20:24
Copy and Movement 9
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
file, err := os.Open("example.txt")
@yakuter
yakuter / bytesBuffer.go
Created February 15, 2024 18:34
Copy and Movement 8
package main
import (
"bytes"
"fmt"
)
func main() {
var buffer bytes.Buffer
@yakuter
yakuter / ioPipeHttpServer.go
Created February 15, 2024 17:25
Copy and Movement 7
package main
import (
"io"
"net/http"
"os"
)
func main() {
http.HandleFunc("/download", func(w http.ResponseWriter, r *http.Request) {
@yakuter
yakuter / ioPipeHttpRequest.go
Created February 15, 2024 17:03
Copy and Movement 6
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {