Welcome to mirror list, hosted at ThFree Co, Russian Federation.

helpers.go - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b418eec35a4f28310ccba7cfdb78d7452cdc4019 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main

import (
	"io/ioutil"
	"net"
	"strings"
)

func readFile(file string) (result []byte) {
	result, err := ioutil.ReadFile(file)
	if err != nil {
		fatal(err)
	}
	return
}

func createSocket(addr string) (l net.Listener, fd uintptr) {
	l, err := net.Listen("tcp", addr)
	if err != nil {
		fatal(err)
	}

	f, err := l.(*net.TCPListener).File()
	if err != nil {
		fatal(err)
	}

	fd = f.Fd()
	return
}

func endsWithSlash(path string) bool {
	return strings.HasSuffix(path, "/")
}