Skip to content

Instantly share code, notes, and snippets.

View jeffotoni's full-sized avatar

Jefferson Otoni Lima jeffotoni

View GitHub Profile
package main
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"log"
"time"
)
Filipe Braga, [20.05.21 09:57]
ID Guia Data no PAGE Data para Atualizar
9510 202105/99510 05/05/2021 27/04/2021
9508 202105/99508 05/05/2021 27/04/2021
9530 202105/99510 05/05/2021 27/04/2021
9528 202105/99528 05/05/2021 27/04/2021
9573 202105/99573 14/04/2021 17/04/2021
9575 202105/99575 05/05/2021 17/04/2021
9578 202105/99578 05/05/2021 17/04/2021
9576 202105/99576 05/05/2021 17/04/2021
Mafê
Jefferson Otoni (via zoom) e Raphael Rossi (presencial)
zoom
https://us02web.zoom.us/j/89048168371
Princípio:
package main
import (
"encoding/gob"
"fmt"
"log"
"net"
)
type CabecalhoServidor struct {
// Em Go a formatação de tempo é única e diferente.
// Em vez de ter um formato convencional para imprimir a data
// Go usa a data de referência 20060102150405 que parece sem sentido
// mas na verdade tem um motivo, pois é 1 2 3 4 5 6 no comando Posix date:
// Mon Jan 2 15:04:05 -0700 MST 2006
// 0 1 2 3 4 5 6
// O fuso horário é 7, mas fica no meio, então, no final, o formato é
// semelhante a 1 2 3 4 5 7 6
package handler
import (
"bytes"
"encoding/json"
"net/http"
"net/http/httptest"
"strings"
"testing"
func createMultipartFormData(t *testing.T, fieldName, fileName string) (bytes.Buffer, *multipart.Writer) {
var b bytes.Buffer
var err error
w := multipart.NewWriter(&b)
var fw io.Writer
file := mustOpen(fileName)
if fw, err = w.CreateFormFile(fieldName, file.Name()); err != nil {
t.Errorf("Error creating writer: %v", err)
}
if _, err = io.Copy(fw, file); err != nil {
FROM golang:1.14 as builder
WORKDIR /go/src/upnid-api
COPY . .
ENV GO111MODULE=on
RUN GOSUMDB=off CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o upnid-api main.go
RUN cp upnid-api /go/bin/upnid-api
# Now copy it into our base image.
FROM gcr.io/distroless/base
COPY --from=builder /go/bin/upnid-api /
package handler
import (
"net/http"
"testing"
)
func TestScore(t *testing.T) {
type args struct {
w http.ResponseWriter
package main
import (
"encoding/json"
"log"
"math/rand"
"net/http"
"time"
)