From ef3cae0984dbd668d82cbdd12a3d2f1c38903eb3 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Ruel Date: Thu, 27 Oct 2022 09:07:14 -0400 Subject: [PATCH] Update to go1.17 Update deprecated code. Update github actions. Update dependencies. --- .github/workflows/test.yml | 31 +++++++++++++++++-------------- allwinner/a64.go | 14 +++++++------- allwinner/doc.go | 2 +- allwinner/h5.go | 12 ++++++------ am335x/doc.go | 4 ++-- bcm283x/doc.go | 4 ++-- bcm283x/gpio.go | 2 +- beagle/black/black.go | 4 ++-- beagle/bone/bone.go | 2 +- beagle/green/green.go | 4 ++-- chip/chip.go | 19 ++++++++++--------- chip/doc.go | 2 +- cpu/cpu.go | 3 +-- cpu/cpu_test.go | 3 +-- distro/devtree.go | 4 ++-- distro/distro.go | 3 +-- ftdi/dev.go | 4 ++-- ftdi/doc.go | 4 ++-- go.mod | 6 +++--- go.sum | 12 ++++++------ odroidc1/doc.go | 2 +- odroidc1/odroidc1.go | 5 +++-- pine64/doc.go | 2 +- pmem/alloc.go | 4 ++-- pmem/doc.go | 14 +++++++------- pmem/pagemap.go | 3 ++- pru/doc.go | 4 ++-- rpi/doc.go | 2 +- rpi/rpi.go | 6 +++--- sysfs/fs_linux.go | 7 ++++--- sysfs/spi.go | 3 +-- videocore/videocore.go | 2 +- 32 files changed, 98 insertions(+), 95 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c75f757..c15ad7df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,7 +30,7 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] # Do not forget to bump every 6 months! - gover: ["1.18"] + gover: ["1.19"] env: PYTHONDONTWRITEBYTECODE: x steps: @@ -101,7 +101,7 @@ jobs: # Windows. os: [ubuntu-latest, macos-latest, windows-latest] # Do not forget to bump every 6 months! - gover: ["1.18"] + gover: ["1.19"] env: PYTHONDONTWRITEBYTECODE: x steps: @@ -161,8 +161,8 @@ jobs: - name: 'Check: no executable was committed (ubuntu)' if: always() && matrix.os == 'ubuntu-latest' run: | - if find . -path '*.sh' -prune -o -path ./.git -prune -o -type f -executable -print | grep -e . ; then - echo 'Do not commit executables beside shell scripts' + if find . -path ./.git -prune -o -type f -executable -print | grep -e . ; then + echo 'Do not commit executables' false fi - name: 'Check: addlicense; all sources have a license header (ubuntu)' @@ -179,10 +179,10 @@ jobs: echo "- ${FILE}" >> _gofmt.txt done cat _gofmt.txt - echo "## ⚠ gofmt Failed" >> _comments.txt - echo "" >> _comments.txt - cat _gofmt.txt >> _comments.txt - echo "" >> _comments.txt + echo "## ⚠ gofmt Failed" >> ../_comments.txt + echo "" >> ../_comments.txt + cat _gofmt.txt >> ../_comments.txt + echo "" >> ../_comments.txt false fi - name: "Check: misspelling; code doesn't contain misspelling (ubuntu)" @@ -191,10 +191,10 @@ jobs: ERR=$(misspell .) if ! test -z "$ERR"; then echo "$ERR" - echo "## ⚠ misspell Failed" >> _comments.txt - echo "" >> _comments.txt - echo "$ERR" >> _comments.txt - echo "" >> _comments.txt + echo "## ⚠ misspell Failed" >> ../_comments.txt + echo "" >> ../_comments.txt + echo "$ERR" >> ../_comments.txt + echo "" >> ../_comments.txt false fi - name: 'Send comments' @@ -269,7 +269,10 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - gover: ['1.13.15'] + # https://github.com/golang/go/issues/55078 + # golang.org/x/sys/unix broke on Go versions before 1.17. Not worth + # fixing. + gover: ['1.17.13'] env: PYTHONDONTWRITEBYTECODE: x steps: @@ -293,7 +296,7 @@ jobs: matrix: os: [ubuntu-latest] # Do not forget to bump every 6 months! - gover: ["1.18"] + gover: ["1.19"] permissions: security-events: write steps: diff --git a/allwinner/a64.go b/allwinner/a64.go index d8713325..340eebb1 100644 --- a/allwinner/a64.go +++ b/allwinner/a64.go @@ -41,13 +41,13 @@ func init() { // The mapping comes from the datasheet page 23: // http://files.pine64.org/doc/datasheet/pine64/A64_Datasheet_V1.1.pdf // -// - The datasheet uses TWI instead of I2C but it is renamed here for -// consistency. -// - AIF is an audio interface, i.e. to connect to S/PDIF. -// - RGMII means Reduced gigabit media-independent interface. -// - SDC means SDCard? -// - NAND connects to a NAND flash controller. -// - CSI and CCI are for video capture. +// - The datasheet uses TWI instead of I2C but it is renamed here for +// consistency. +// - AIF is an audio interface, i.e. to connect to S/PDIF. +// - RGMII means Reduced gigabit media-independent interface. +// - SDC means SDCard? +// - NAND connects to a NAND flash controller. +// - CSI and CCI are for video capture. var mappingA64 = map[string][5]pin.Func{ "PB0": {"UART2_TX", "", "JTAG0_TMS", "", "PB_EINT0"}, "PB1": {"UART2_RX", "", "JTAG0_TCK", "SIM_PWREN", "PB_EINT1"}, diff --git a/allwinner/doc.go b/allwinner/doc.go index c2cc83cc..7725b6b2 100644 --- a/allwinner/doc.go +++ b/allwinner/doc.go @@ -11,7 +11,7 @@ // If you are looking at the actual implementation, open doc.go for further // implementation details. // -// Datasheets +// # Datasheets // // A64: http://files.pine64.org/doc/datasheet/pine64/Allwinner_A64_User_Manual_V1.0.pdf // diff --git a/allwinner/h5.go b/allwinner/h5.go index 1c60327f..d9e2b8cb 100644 --- a/allwinner/h5.go +++ b/allwinner/h5.go @@ -22,12 +22,12 @@ import ( // The mapping comes from the datasheet page 55: // https://linux-sunxi.org/images/a/a3/Allwinner_H5_Manual_v1.0.pdf // -// - The datasheet uses TWI instead of I2C but it is renamed here for -// consistency. -// - RGMII means Reduced gigabit media-independent interface. -// - SDC means SDCard? -// - NAND connects to a NAND flash controller. -// - CSI and CCI are for video capture. +// - The datasheet uses TWI instead of I2C but it is renamed here for +// consistency. +// - RGMII means Reduced gigabit media-independent interface. +// - SDC means SDCard? +// - NAND connects to a NAND flash controller. +// - CSI and CCI are for video capture. var mappingH5 = map[string][5]pin.Func{ "PA0": {"UART2_TX", "JTAG_MS", "", "", "PA_EINT0"}, "PA1": {"UART2_RX", "JTAG_CK", "", "", "PA_EINT1"}, diff --git a/am335x/doc.go b/am335x/doc.go index 2967405b..de95e936 100644 --- a/am335x/doc.go +++ b/am335x/doc.go @@ -13,12 +13,12 @@ // GPIOx_y. To get the absolute number, as exposed by sysfs, use 32*x+y to get // the absolute number. // -// Datasheet +// # Datasheet // // Technical Reference Manual // https://www.ti.com/lit/ug/spruh73p/spruh73p.pdf // -// Other +// # Other // // Marketing page // https://www.ti.com/processors/sitara/arm-cortex-a8/am335x/overview.html diff --git a/bcm283x/doc.go b/bcm283x/doc.go index d18ea294..0bbea729 100644 --- a/bcm283x/doc.go +++ b/bcm283x/doc.go @@ -10,12 +10,12 @@ // If you are looking for the actual implementation, open doc.go for further // implementation details. // -// GPIOs +// # GPIOs // // Aliases for GPCLK0, GPCLK1, GPCLK2 are created for corresponding CLKn pins. // Same for PWM0_OUT and PWM1_OUT, which point respectively to PWM0 and PWM1. // -// Datasheet +// # Datasheet // // https://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf // diff --git a/bcm283x/gpio.go b/bcm283x/gpio.go index 669a4451..dc51c204 100644 --- a/bcm283x/gpio.go +++ b/bcm283x/gpio.go @@ -590,7 +590,7 @@ func (p *Pin) FastOut(l gpio.Level) { // // It outputs a periodic signal on supported pins without CPU usage. // -// PWM pins +// # PWM pins // // PWM0 is exposed on pins 12, 18 and 40. However, PWM0 is used for generating // clock for DMA and unavailable for PWM. diff --git a/beagle/black/black.go b/beagle/black/black.go index 8df1858f..f4cf6635 100644 --- a/beagle/black/black.go +++ b/beagle/black/black.go @@ -5,11 +5,11 @@ // Package black implements headers for the BeagleBone Black and BeagleBone // Black Wireless micro-computers. // -// Reference +// # Reference // // https://beagleboard.org/black // -// Datasheet +// # Datasheet // // https://elinux.org/Beagleboard:BeagleBoneBlack // diff --git a/beagle/bone/bone.go b/beagle/bone/bone.go index c8929bbd..a876aee8 100644 --- a/beagle/bone/bone.go +++ b/beagle/bone/bone.go @@ -8,7 +8,7 @@ // In particular, the headers are found on the models using a TI AM335x // processor: BeagleBone Black, Black Wireless, Green and Green Wireless. // -// Reference +// # Reference // // http://beagleboard.org/Support/bone101/#hardware package bone diff --git a/beagle/green/green.go b/beagle/green/green.go index 79d18c96..2c720cf6 100644 --- a/beagle/green/green.go +++ b/beagle/green/green.go @@ -5,13 +5,13 @@ // Package green implements headers for the BeagleBone Green and BeagleBone // Green Wireless micro-computers. // -// Reference +// # Reference // // https://beagleboard.org/green // // https://beagleboard.org/green-wireless // -// Datasheet +// # Datasheet // // http://wiki.seeedstudio.com/BeagleBone_Green/ package green diff --git a/chip/chip.go b/chip/chip.go index 62bfbbb0..613a96f7 100644 --- a/chip/chip.go +++ b/chip/chip.go @@ -7,7 +7,7 @@ package chip import ( "errors" "fmt" - "io/ioutil" + "io" "os" "path/filepath" "strconv" @@ -126,13 +126,14 @@ var ( // // It looks for "C.H.I.P" in the device tree. The following information is // expected in the device dtree: -// root@chip2:/proc/device-tree# od -c compatible -// 0000000 n e x t t h i n g , c h i p \0 a -// 0000020 l l w i n n e r , s u n 5 i - r -// 0000040 8 \0 -// root@chip2:/proc/device-tree# od -c model -// 0000000 N e x t T h i n g C . H . I . -// 0000020 P . \0 +// +// root@chip2:/proc/device-tree# od -c compatible +// 0000000 n e x t t h i n g , c h i p \0 a +// 0000020 l l w i n n e r , s u n 5 i - r +// 0000040 8 \0 +// root@chip2:/proc/device-tree# od -c model +// 0000000 N e x t T h i n g C . H . I . +// 0000020 P . \0 func Present() bool { return strings.Contains(distro.DTModel(), "C.H.I.P") } @@ -223,7 +224,7 @@ func findXIOBase() int { if err != nil { continue } - b, err := ioutil.ReadAll(f) + b, err := io.ReadAll(f) if err1 := f.Close(); err == nil { err = err1 } diff --git a/chip/doc.go b/chip/doc.go index c55d43b2..3bba9209 100644 --- a/chip/doc.go +++ b/chip/doc.go @@ -19,7 +19,7 @@ // also supported on the XIO pins, but this feature is rather limited due to // the device and the driver (for example, the driver interrupts on all edges). // -// References +// # References // // http://www.chip-community.org/index.php/Hardware_Information // diff --git a/cpu/cpu.go b/cpu/cpu.go index 6170c0f5..c17ed7a8 100644 --- a/cpu/cpu.go +++ b/cpu/cpu.go @@ -6,7 +6,6 @@ package cpu import ( "io" - "io/ioutil" "os" "strconv" "strings" @@ -61,7 +60,7 @@ func getMaxSpeedLinux() int64 { maxSpeed = 0 if f, err := openFile("/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq", os.O_RDONLY); err == nil { defer f.Close() - if b, err := ioutil.ReadAll(f); err == nil { + if b, err := io.ReadAll(f); err == nil { s := strings.TrimSpace(string(b)) if i, err := strconv.ParseInt(s, 10, 64); err == nil { // Weirdly, the speed is listed as khz. :( diff --git a/cpu/cpu_test.go b/cpu/cpu_test.go index 1bb2f977..f36a1ecf 100644 --- a/cpu/cpu_test.go +++ b/cpu/cpu_test.go @@ -7,7 +7,6 @@ package cpu import ( "bytes" "io" - "io/ioutil" "os" "testing" "time" @@ -31,7 +30,7 @@ func TestMaxSpeed(t *testing.T) { if flag != os.O_RDONLY { t.Fatal(flag) } - return ioutil.NopCloser(bytes.NewBufferString("1001\n")), nil + return io.NopCloser(bytes.NewBufferString("1001\n")), nil } MaxSpeed() if s := getMaxSpeedLinux(); s != 1001000 { diff --git a/distro/devtree.go b/distro/devtree.go index e8c2da43..970b4f96 100644 --- a/distro/devtree.go +++ b/distro/devtree.go @@ -6,7 +6,7 @@ package distro import ( "encoding/binary" - "io/ioutil" + "os" ) // DTModel returns platform model info from the Linux device tree (/proc/device-tree/model), and @@ -50,7 +50,7 @@ func DTRevision() uint32 { return dtRevision } dtRevisionRead = true - if b, _ := ioutil.ReadFile("/proc/device-tree/system/linux,revision"); len(b) >= 4 { + if b, _ := os.ReadFile("/proc/device-tree/system/linux,revision"); len(b) >= 4 { dtRevision = binary.BigEndian.Uint32(b[:4]) } return dtRevision diff --git a/distro/distro.go b/distro/distro.go index 96e49dfb..c116b6aa 100644 --- a/distro/distro.go +++ b/distro/distro.go @@ -10,7 +10,6 @@ package distro import ( - "io/ioutil" "os" "strconv" "strings" @@ -98,7 +97,7 @@ var ( mu sync.Mutex cpuInfo map[string]string osRelease map[string]string - readFile = ioutil.ReadFile + readFile = os.ReadFile ) func splitSemiColon(content string) map[string]string { diff --git a/ftdi/dev.go b/ftdi/dev.go index 55dff09e..7a8ffadf 100644 --- a/ftdi/dev.go +++ b/ftdi/dev.go @@ -285,7 +285,7 @@ func newFT232H(g generic) (*FT232H, error) { // Pins C8 and C9 can only be used in 'slow' mode via EEPROM and are currently // not implemented. // -// Datasheet +// # Datasheet // // http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232H.pdf type FT232H struct { @@ -517,7 +517,7 @@ func newFT232R(g generic) (*FT232R, error) { // Pin C4 can only be used in 'slow' mode via EEPROM and is currently not // implemented. // -// Datasheet +// # Datasheet // // http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232R.pdf type FT232R struct { diff --git a/ftdi/doc.go b/ftdi/doc.go index 05182b17..590b8c3a 100644 --- a/ftdi/doc.go +++ b/ftdi/doc.go @@ -9,12 +9,12 @@ // // Use build tag periph_host_ftdi_debug to enable verbose debugging. // -// More details +// # More details // // See https://periph.io/device/ftdi/ for more details, and how to configure // the host to be able to use this driver. // -// Datasheets +// # Datasheets // // http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232R.pdf // diff --git a/go.mod b/go.mod index af7546af..52e18006 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,9 @@ module periph.io/x/host/v3 -go 1.13 +go 1.17 require ( - periph.io/x/conn/v3 v3.6.10 - periph.io/x/d2xx v0.0.4 + periph.io/x/conn/v3 v3.7.0 + periph.io/x/d2xx v0.1.0 ) diff --git a/go.sum b/go.sum index 53581b4f..243f44a6 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ -github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= -github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= -periph.io/x/conn/v3 v3.6.10 h1:gwU4ssmZkq1D/uz8hU91i/COo2c9DrRaS4PJZBbCd+c= -periph.io/x/conn/v3 v3.6.10/go.mod h1:UqWNaPMosWmNCwtufoTSTTYhB2wXWsMRAJyo1PlxO4Q= -periph.io/x/d2xx v0.0.4 h1:R1Yejby5Ny6cVRo94RlMgXFtpp6AJrsVNAAjQCQx5rA= -periph.io/x/d2xx v0.0.4/go.mod h1:38Euaaj+s6l0faIRHh32a+PrjXvxFTFkPBEQI0TKg34= +github.com/jonboulle/clockwork v0.3.0 h1:9BSCMi8C+0qdApAp4auwX0RkLGUjs956h0EkuQymUhg= +github.com/jonboulle/clockwork v0.3.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= +periph.io/x/conn/v3 v3.7.0 h1:f1EXLn4pkf7AEWwkol2gilCNZ0ElY+bxS4WE2PQXfrA= +periph.io/x/conn/v3 v3.7.0/go.mod h1:ypY7UVxgDbP9PJGwFSVelRRagxyXYfttVh7hJZUHEhg= +periph.io/x/d2xx v0.1.0 h1:aR+hMkz57YbQHR+Rji4jHH43YLTITRZUr2HjhqCYa7k= +periph.io/x/d2xx v0.1.0/go.mod h1:OflHQcWZ4LDP/2opGYbdXSP/yvWSnHVFO90KRoyobWY= diff --git a/odroidc1/doc.go b/odroidc1/doc.go index c004893e..b7d19049 100644 --- a/odroidc1/doc.go +++ b/odroidc1/doc.go @@ -16,7 +16,7 @@ // header pins 19/21/23/24. The onewire gpio driver appears to be loaded by // default on header pin 7. // -// References +// # References // // Product page: http://www.hardkernel.com/main/products/prdt_info.php?g_code=G143703355573&tab_idx=2 // diff --git a/odroidc1/odroidc1.go b/odroidc1/odroidc1.go index 6ea95099..1ad2e8c1 100644 --- a/odroidc1/odroidc1.go +++ b/odroidc1/odroidc1.go @@ -67,8 +67,9 @@ var ( // // It looks for "8726_M8B" in the device tree or "ODROIDC" in cpuinfo. The // following information is expected in the device dtree: -// root@odroid:/proc/device-tree# od -c compatible -// 0000000 A M L O G I C , 8 7 2 6 _ M 8 B +// +// root@odroid:/proc/device-tree# od -c compatible +// 0000000 A M L O G I C , 8 7 2 6 _ M 8 B func Present() bool { for _, c := range distro.DTCompatible() { if strings.Contains(c, "8726_M8B") { diff --git a/pine64/doc.go b/pine64/doc.go index 251aa2b5..8a4cf2b7 100644 --- a/pine64/doc.go +++ b/pine64/doc.go @@ -7,7 +7,7 @@ // // Requires Armbian Jessie Server. // -// Physical +// # Physical // // http://files.pine64.org/doc/Pine%20A64%20Schematic/Pine%20A64%20Pin%20Assignment%20160119.pdf // diff --git a/pmem/alloc.go b/pmem/alloc.go index 5cdde3c4..8f957a92 100644 --- a/pmem/alloc.go +++ b/pmem/alloc.go @@ -7,7 +7,7 @@ package pmem import ( "bytes" "io" - "io/ioutil" + "os" "reflect" "sync" "unsafe" @@ -172,7 +172,7 @@ func toRaw(b []byte) uintptr { // isWSL returns true if running under Windows Subsystem for Linux. func isWSL() bool { wslOnce.Do(func() { - if c, err := ioutil.ReadFile("/proc/sys/kernel/osrelease"); err == nil { + if c, err := os.ReadFile("/proc/sys/kernel/osrelease"); err == nil { isWSLValue = bytes.Contains(c, []byte("Microsoft")) } }) diff --git a/pmem/doc.go b/pmem/doc.go index b16c6646..9bf4db76 100644 --- a/pmem/doc.go +++ b/pmem/doc.go @@ -7,7 +7,7 @@ // To make things confusing, a modern computer has many view of the memory // (address spaces): // -// User +// # User // // User mode address space is the virtual address space that an application // runs in. It is generally a tad less than half the addressable memory, so on @@ -15,7 +15,7 @@ // but it usually at least 3.5Gb. The memory is virtual and can be flushed to // disk in the swap file unless individual pages are locked. // -// Kernel +// # Kernel // // Kernel address space is the virtual address space the kernel sees. It often // can see the currently active user space program on the current CPU core in @@ -24,7 +24,7 @@ // when there's not enough RAM available. On linux systems, the kernel // addressed memory can be mapped in user space via `/dev/kmem`. // -// Physical +// # Physical // // Physical memory address space is the actual address of each page in the DRAM // chip and anything connected to the memory controller. The mapping may be @@ -33,7 +33,7 @@ // memory than the host CPU. On linux systems, this memory can be mapped in // user space via `/dev/mem`. // -// CPU +// # CPU // // The CPU or its subsystems may memory map registers (for example, to control // GPIO pins, clock speed, etc). This is not "real" memory, this is a view of @@ -50,19 +50,19 @@ // space program writing data to a memory page and immediately asking the DMA // controller to read it may cause stale data to be read! // -// Hypervisor +// # Hypervisor // // Hypervisor can change the complete memory mapping as seen by the kernel. // This is outside the scope of this project. :) // -// Summary +// # Summary // // In practice, the semantics change between CPU manufacturers (Broadcom vs // Allwinner) and between architectures (ARM vs x86). The most tricky one is to // understand cached memory and how it affects coherence and performance. // Uncached memory is extremely slow so it must only be used when necessary. // -// References +// # References // // Overview of IOMMU: // https://en.wikipedia.org/wiki/Input-output_memory_management_unit diff --git a/pmem/pagemap.go b/pmem/pagemap.go index 362cf49c..bd102e43 100644 --- a/pmem/pagemap.go +++ b/pmem/pagemap.go @@ -8,6 +8,7 @@ import ( "encoding/binary" "errors" "fmt" + "io" "os" ) @@ -50,7 +51,7 @@ func readPageMapLinux(virtAddr uintptr) (uint64, error) { } // Convert address to page number, then index in uint64 array. offset := int64(virtAddr / pageSize * 8) - if _, err := pageMap.Seek(offset, os.SEEK_SET); err != nil { + if _, err := pageMap.Seek(offset, io.SeekStart); err != nil { return 0, fmt.Errorf("pmem: failed to seek at 0x%x for 0x%x: %v", offset, virtAddr, err) } n, err := pageMap.Read(b[:]) diff --git a/pru/doc.go b/pru/doc.go index b98abba4..a213e15f 100644 --- a/pru/doc.go +++ b/pru/doc.go @@ -21,7 +21,7 @@ // // - 4x PRUs on 66ak2g02; http://www.ti.com/product/66ak2g02 // -// Datasheet +// # Datasheet // // Technical Reference Manual starting at page 199: // https://www.ti.com/lit/ug/spruh73p/spruh73p.pdf @@ -32,7 +32,7 @@ // Picture summary of instructions: // http://exploringbeaglebone.com/wp-content/uploads/2014/12/Instruction-Set-Sheet.png // -// Help +// # Help // // Hands-on videos // http://beagleboard.org/pru diff --git a/rpi/doc.go b/rpi/doc.go index 8730b9d4..7e92c1f1 100644 --- a/rpi/doc.go +++ b/rpi/doc.go @@ -8,7 +8,7 @@ // Assumes Raspbian but does not directly depend on the distro being Raspbian. // Windows IoT is currently not supported. // -// Physical +// # Physical // // The physical pin out is based on http://www.raspberrypi.org information but // http://pinout.xyz/ has a nice interactive web page. diff --git a/rpi/rpi.go b/rpi/rpi.go index 143e81c2..b149de7b 100644 --- a/rpi/rpi.go +++ b/rpi/rpi.go @@ -315,9 +315,9 @@ var ( // revisionCode processes the CPU revision code based on documentation at // https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md // -// Format is: uuuuuuuuFMMMCCCCPPPPTTTTTTTTRRRR -// 2 2 1 1 0 0 -// 3 0 6 2 4 0 +// Format is: uuuuuuuuFMMMCCCCPPPPTTTTTTTTRRRR +// 2 2 1 1 0 0 +// 3 0 6 2 4 0 type revisionCode uint32 // parseRevision processes the old style revision codes to new style bitpacked diff --git a/sysfs/fs_linux.go b/sysfs/fs_linux.go index 2416a7d9..c945b96d 100644 --- a/sysfs/fs_linux.go +++ b/sysfs/fs_linux.go @@ -246,9 +246,10 @@ func (e *eventsListener) loop() { // addFd lazy initializes eventsListener if it was not initialized yet. // // It can fail due to various reasons, a few are: -// ENOSPC: /proc/sys/fs/epoll/max_user_watches limit was exceeded -// ENOMEM: No memory available -// EPERM: fd is a regular file or directory +// +// ENOSPC: /proc/sys/fs/epoll/max_user_watches limit was exceeded +// ENOMEM: No memory available +// EPERM: fd is a regular file or directory func (e *eventsListener) addFd(fd uintptr, c chan<- time.Time, flags epollEvent) error { if c == nil { return errors.New("fd: addFd requires a valid channel") diff --git a/sysfs/spi.go b/sysfs/spi.go index b45681ae..1305d0bc 100644 --- a/sysfs/spi.go +++ b/sysfs/spi.go @@ -8,7 +8,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "os" "path/filepath" "sort" @@ -584,7 +583,7 @@ func (d *driverSPI) Init() (bool, error) { return true, err } defer f.Close() - b, err := ioutil.ReadAll(f) + b, err := io.ReadAll(f) if err != nil { return true, err } diff --git a/videocore/videocore.go b/videocore/videocore.go index d11eb0e5..00255535 100644 --- a/videocore/videocore.go +++ b/videocore/videocore.go @@ -7,7 +7,7 @@ // This package shouldn't be used directly, it is used by bcm283x's DMA // implementation. // -// Datasheet +// # Datasheet // // While not an actual datasheet, this is the closest to actual formal // documentation: