I have the following code:
3 /*
4 selinux.go - return the sestatus
5
6
7 The lines below are preamble to the import of "C" -
8 they should be left untouched
9 */
10
11 // //cgo linux CFLAGS: -Iinclude -I.
12 // #cgo pkg-config: libselinux
13 // #include <selinux/selinux.h>
14 // #include <selinux/label.h>
15 // #include <stdlib.h>
16 // #include <stdio.h>
17 // #include <sys/types.h>
18 // #include <sys/stat.h>
19
20 import "C"
21 import (
22 "fmt"
23 "net/http"
24 )
25
26 const (
27 Enforcing = 1
28 Permissive = 0
29 Disabled = -1
30 )
31
32 func init() {
33 if len(testFunctionsMap) == 0 {
34 testFunctionsMap = make(funcPtrMap)
35 }
36 testFunctionsMap["selinux"] = SELinuxStatus
37 initCtr++
38 }
The program also has several other files all in package main. The init functions in those files do get called; this init function doesn't - "selinux" never gets added to the testFunctionsMap.
This used to work - I think on 1.9 was the previous version. I've looked at the release notes, and it seems that work has been done on cgo - but I can't see anything which might explain this behaviour.
Thanks.