Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for listGroupsFromReader (0.51 sec)

  1. src/os/user/listgroups_unix.go

    package user
    
    import (
    	"bufio"
    	"bytes"
    	"errors"
    	"fmt"
    	"io"
    	"os"
    	"strconv"
    )
    
    func listGroupsFromReader(u *User, r io.Reader) ([]string, error) {
    	if u.Username == "" {
    		return nil, errors.New("user: list groups: empty username")
    	}
    	primaryGid, err := strconv.Atoi(u.Gid)
    	if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 07 23:34:21 UTC 2023
    - 2.9K bytes
    - Viewed (0)
  2. src/os/user/listgroups_unix_test.go

    	{in: "", user: "joanna", gid: "bad", err: true},
    }
    
    func TestListGroups(t *testing.T) {
    	for _, tc := range listGroupsTests {
    		u := &User{Username: tc.user, Gid: tc.gid}
    		got, err := listGroupsFromReader(u, strings.NewReader(tc.in))
    		if tc.err {
    			if err == nil {
    				t.Errorf("listGroups(%q): got nil; want error", tc.user)
    			}
    			continue // no more checks
    		}
    		if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 3K bytes
    - Viewed (0)
Back to top