Xcode 14.2 not starting

I had a problem where Xcode not opening a project or starting at all. Sometimes it just froze. The solution I found out working was cloing the repository to another folder that is not desktop or document and it works. I also disabled iCloud, updated the Mac, cleared some cache folders, but in the end I think where the repo is opening from is the most important. Also, I removed the git account and added it again too in Xcode.

Deploy golang service to Google Cloud

We will be using Google Cloud Run with the help of a Dockerfile. First, let’s say you have an application like this (main.go file below)

// Sample run-helloworld is a minimal Cloud Run service.
package main

import (
	"fmt"
	"log"
	"net/http"
	"os"
)

func main() {
	log.Print("starting server...")
	http.HandleFunc("/", handler)

	// Determine port for HTTP service.
	port := os.Getenv("PORT")
	if port == "" {
		port = "8080"
		log.Printf("defaulting to port %s", port)
	}

	// Start HTTP server.
	log.Printf("listening on port %s", port)
	if err := http.ListenAndServe(":"+port, nil); err != nil {
		log.Fatal(err)
	}
}

func handler(w http.ResponseWriter, r *http.Request) {
	name := os.Getenv("NAME")
	if name == "" {
		name = "World"
	}
	fmt.Fprintf(w, "Hello %s!\n", name)
}

Then you’ll need to create a Dockerfile in your directory (same as main.go):

FROM golang:1.19 as build
WORKDIR /go/src/app
COPY . .
RUN go build -v -o app .

FROM gcr.io/distroless/base
COPY --from=build /go/src/app/. /
CMD ["/app"]

Then we can run this command (with Google Cloud SDK installed). myservice is the new name of the image I give here.

gcloud builds submit --tag gcr.io/my-projectID/myservice

All building from the Dockerfile is built from Cloud Build. You can check how it is going at the Cloud Build page under history. We now have an image we can publish. Run the following command to deploy the image:

gcloud run deploy myservice --image gcr.io/my-projectID/myservice

Then we are done!