diff --git a/foomo/blog/2022-01-19-map-race-debugging/index.mdx b/foomo/blog/2022-01-19-map-race-debugging/index.mdx new file mode 100644 index 0000000..1e0d0b7 --- /dev/null +++ b/foomo/blog/2022-01-19-map-race-debugging/index.mdx @@ -0,0 +1,9 @@ +--- +slug: debugging-go-map-races-in-k8s +authors: [ philipp ] +tags: [ go, debugging, backend ] +--- +# debugging Go map races in k8s + + + diff --git a/foomo/blog/authors.yml b/foomo/blog/authors.yml index cb41ed0..94fb2c2 100644 --- a/foomo/blog/authors.yml +++ b/foomo/blog/authors.yml @@ -3,3 +3,8 @@ jan: title: foomo maintainer url: https://github.com/janhalfar image_url: https://github.com/janhalfar.png +philipp: + name: Philipp Mieden + title: MSc + url: https://github.com/dreadl0ck + image_url: https://github.com/dreadl0ck.png diff --git a/foomo/docs/backend/go-by-example/map-racing.md b/foomo/docs/backend/go-by-example/map-racing.md new file mode 100644 index 0000000..c23638a --- /dev/null +++ b/foomo/docs/backend/go-by-example/map-racing.md @@ -0,0 +1 @@ +# map races \ No newline at end of file diff --git a/foomo/docs/backend/go-by-example/panic-and-recover.md b/foomo/docs/backend/go-by-example/panic-and-recover.md new file mode 100644 index 0000000..a362bd7 --- /dev/null +++ b/foomo/docs/backend/go-by-example/panic-and-recover.md @@ -0,0 +1,2 @@ +# panic and recover + diff --git a/foomo/src/components/GoPlayground.tsx b/foomo/src/components/GoPlayground.tsx index 9cfe722..0a88725 100644 --- a/foomo/src/components/GoPlayground.tsx +++ b/foomo/src/components/GoPlayground.tsx @@ -21,8 +21,6 @@ import { IsItCool } from "./IsItCool"; import Highlight, { defaultProps } from "prism-react-renderer"; import Link from "@docusaurus/Link"; -//src={"https://play.golang.org/p/" + props.id} - export const GoPlayground = (props: { id: string; proportion: number }) => { const [interactive, setInteractive] = useState(false); const [source, setSource] = useState(""); @@ -32,16 +30,12 @@ export const GoPlayground = (props: { id: string; proportion: number }) => { fetch("http://localhost:8080/?id=" + props.id, { mode: "cors", }) - .then((res) => - res - .json() - .then((data) => setSource(data.code)) - .catch((e) => setSource("parse json")) - ) + .then((res) => res.text().then((newSource) => setSource(newSource))) .catch((e) => setSource("can not load source yet")); } }, [source]); const href = "https://goplay.tools/snippet/" + props.id; + return ( <>
diff --git a/playgroundserver/main.go b/playgroundserver/main.go index b8b5b6e..9ba3992 100644 --- a/playgroundserver/main.go +++ b/playgroundserver/main.go @@ -39,13 +39,15 @@ func serve(w http.ResponseWriter, r *http.Request) { http.Error(w, "no id get param given", http.StatusBadRequest) return } - resp, err := http.Get("https://goplay.tools/api/snippet/" + id) + + //resp, err := http.Get("https://goplay.tools/api/snippet/" + id) + resp, err := http.Get("https://go.dev/_/share?id=" + id) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } w.Header().Set("Access-Control-Allow-Origin", "*") - w.Header().Set("Content-Type", "application/json") + w.Header().Set("Content-Type", "text/plain") io.Copy(w, resp.Body) resp.Body.Close() }